document.form1 is undefined

在执行Ajax教程里面的代码的时候,总是提示错误:

IE“错误: 无法获取未定义或 null 引用的属性“action”“
FireFox "TypeError: document.form1 is undefined"
错误语句为:request.open("POST", document.form1.action);
但是在firefox里面的firebug中的DOM面板中确实能够显示document-forms-form1-action的值:"http://localhost:54889/Chapter%201/Listing1_2.aspx",
解决方案1:这里将document.form1.action替换为字符串之后,程序运行正常。下面是程序源代码。
IE,Firefox,chrome,safari 运行没问题。
解决方案2:将document.forms.form1.action代替原来的doucument.form1.action
posted on 2014-04-17 14:03  Eton..Bee  阅读(287)  评论(0编辑  收藏  举报