如何将javascript应用程序集成到ASP.NET应用程序中?
你好!我在代码项目(高级键入测试中找到了一个很好的javascript输入测试).我想将此包含在我正在开发的ASP.NET 2.0(VB.NET)应用程序中(我正在使用Visual Web Developer 2010),但是在两个方面遇到了麻烦:
首先是当我将javascript粘贴到.aspx页面中时遇到的一堆错误.如果我从.html文件运行此文件,它将运行完美.错误仅显示在.aspx页中.以下是从网站上运行该页面时的一些错误示例:
Hello! I found an excellent javascript typing test here on Code Project (Advanced Typing Test). I would like to include this in an ASP.NET 2.0 (VB.NET) application that I am developing(I am using Visual Web Developer 2010), but am having trouble in two areas:
The first is a bunch of errors that I get when I paste the javascript into my .aspx page. If I run this from an .html file, it runs perfectly. The errors only show up in the .aspx page. Below are a few error samples when the page runs from a website:
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)Timestamp: Wed, 2 Feb 2011 20:32:47
UTCMessage: ''document.JobOp.given'' is null or not an object
Line: 492Char: 2 Code: 0Message: Object required
Line: 402Char: 1 Code: 0Message: ''document.JobOp.start'' is null or not an object
Line: 154Char: 2 Code: 0Message: ''document.JobOp.start'' is null or not an object
Line: 154Char: 2 Code: 0
我还可以解决其他错误(较小的错误,例如未用引号引起来的属性).但是,另一个问题是如何使最终键入速度回到.aspx页(也许是回发),以便可以将其提交到数据库.
我必须承认,我完全不熟悉javascript....如果有人可以解决这些问题,我将不胜感激.
我会发布用于测试的javascript,但是由于它位于网站上的其他位置,因此我认为这是不必要的.
谢谢,提前.
There were other errors that I was able to fix (minor ones like attributes not enclosed in quotation marks). However, the other issue is how to get the final typing speed back to the .aspx page (postback, perhaps?) so that it can be submitted to a database.
I must admit, I am totally unfamiliar with javascript.... If anyone could help with these issues, I would be entirely grateful.
I would post the javascript for the typing test, but, as it is located elsewhere on the site, I felt that unnecessary.
Thanks, in advance.
您为表单命名了吗?
Did you name the form?