javascript的问题!

pan5 2003-11-25 02:54:28
最近我做了javascript的调试,但在调试的时候老是出现“form1.txtname.value不是对象或这是为空“是不什么原因呢?我可是照书写的打进去!谢谢!
...全文
34 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
hcsunjun 2003-11-25
  • 打赏
  • 举报
回复
<form name="form1">
<input type="text" name="txtname" value="value">
</form>
<input type="button" onclick="alert(form1.txtname.value)">
<input type="button" onclick="alert(document.all.txtname.value)">
<input type="button" onclick="alert(document.forms[0].txtname.value)">
hotel9545 2003-11-25
  • 打赏
  • 举报
回复
"document.forms[0].txtname.value" 并不是一个语句,它不完整,所以会出错,

<input type="button" onclick="document.forms[0].txtname.value">————这句单击以后想完成什么功能呢?
chinayang9 2003-11-25
  • 打赏
  • 举报
回复
onclick="form1.txtname.value"
这是个什么东西?
应该是onclick=submit吧。
gjd111686 2003-11-25
  • 打赏
  • 举报
回复
<form name="form1">
<input type="text" name="txtname" value="value">
</form>
<input type="button" onclick="form1.txtname.value">
<input type="button" onclick="document.all.txtname.value">
<input type="button" onclick="document.forms[0].txtname.value">
gdjxlhc 2003-11-25
  • 打赏
  • 举报
回复
你把你打的程序贴到这里来才好说。。。
阿米果 2003-11-25
  • 打赏
  • 举报
回复
现在的书经常出错
iinohk 2003-11-25
  • 打赏
  • 举报
回复
你確定你有定義form1?
你確定你有定義txtname?
你確定txtname包含在form1之內?

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧