关于使用docuemnt.write问题
2004-11-14 08:05
771 查看
先来看看这样一段代码:
<HTML>
<HEAD>
</script>
</HEAD>
<BODY>
Name:<input type="text" name="yidishui"/><br>
Age: <input type="text" name="yidishui1"/><br>
<input type="button" onclick="GetValue1()" value="call->GetValue1"/> <input type="button" onclick="GetValue2()" value="call->GetValue2"/>
</BODY>
</HTML>
看上去两个函数达到的是同一个效果,但是不然。
调用函数GetValue1()运行是达不到效果,欢鳪etValue2()可以实现
。
。
。
===============
调用GetValue1() 是出现错误原因 在使用了第二个 是document.write()出错 ,此时的yidishui1对象已经不存在了,因为使用第一个docuemnt.wrte()时重写了整个页面,所以用的二个时yidishui1对象不存在了!!!
大家可以看看英文对docuemnt.write()的解释:
You should not use the write or writelen methods on the current document after the document has finished loading unless you first call the open method, which clears the current document's window and erases all variables
<HTML>
<HEAD>
</script>
</HEAD>
<BODY>
Name:<input type="text" name="yidishui"/><br>
Age: <input type="text" name="yidishui1"/><br>
<input type="button" onclick="GetValue1()" value="call->GetValue1"/> <input type="button" onclick="GetValue2()" value="call->GetValue2"/>
</BODY>
</HTML>
看上去两个函数达到的是同一个效果,但是不然。
调用函数GetValue1()运行是达不到效果,欢鳪etValue2()可以实现
。
。
。
===============
调用GetValue1() 是出现错误原因 在使用了第二个 是document.write()出错 ,此时的yidishui1对象已经不存在了,因为使用第一个docuemnt.wrte()时重写了整个页面,所以用的二个时yidishui1对象不存在了!!!
大家可以看看英文对docuemnt.write()的解释:
You should not use the write or writelen methods on the current document after the document has finished loading unless you first call the open method, which clears the current document's window and erases all variables
相关文章推荐
- 关于java中servlet使用Write乱码问题
- 关于区别docuemnt.write()和document.getELementById().innerHTML=""
- 关于使用 jBox 对话框的提交问题
- 获取主机名称是关于SetComputerNameEx函数的使用问题!
- 关于伸缩盒子的使用问题
- 关于使用matlab 灰度矩阵问题
- 关于使用Maven过程中不支持源选项1.5问题
- 关于安装IE8之后VS2008使用MFC出现问题的解决方法
- 关于FlashBuilder使用Starling框架调试运行出错问题(Chrome、Firef...
- Unity关于有些代码不能在除主线程外的线程使用的问题
- 关于Axis2 Eclipse plugin在eclipse中不能使用的问题
- 关于Arcgis的部分ArcToolBox工具,在AE中使用时没有授权的问题
- 关于tablviewcell删除的使用及子控件错位问题的处理
- 关于session过期返回主页解决方案之一以及js中的“和'使用问题
- 关于使用Java Mail 发邮件,连接超时问题
- 关于使用Eclipse导出jar文件时图片不能显示的问题
- 关于尝试GUI的简易使用过程中遇到的问题1
- 关于使用universal usb installer 安装 archlinux 失败的问题
- 关于在Linux环境下使用CUnit的遇到的问题总结
- 在WEB程序中使用.NET Remoting的IpcChannel时注意事项(关于“拒绝访问”问题的解决)