document.addcontent是什么、求大佬解释!

weixin_39868476 2018-01-31 10:31:51
今天我们后端写了一段代码
var xzz=document.addcontent.xzz.value;
if(xzz==''){
alert('请填写现住址!');
document.addcontent.xzz.focus();
return false;
}


出现了document.addcontent,我一个小白前端没见过这个东西是什么……
...全文
1013 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
a120603025 2018-03-01
  • 打赏
  • 举报
回复
你可以自己试一下,正常是id才可以吧。因为id是唯一的
usecf 2018-01-31
  • 打赏
  • 举报
回复
参考下这个http://www.jdom.org/docs/apidocs/org/jdom2/Document.html addContent public Document addContent(Content child) Appends the child to the end of the content list. Specified by: addContent in interface Parent Parameters: child - child to append to end of content list Returns: the document on which the method was called Throws: IllegalAddException - if the given child already has a parent. addContent public Document addContent(java.util.Collection<? extends Content> c) Appends all children in the given collection to the end of the content list. In event of an exception during add the original content will be unchanged and the objects in the supplied collection will be unaltered. Specified by: addContent in interface Parent Parameters: c - collection to append Returns: the document on which the method was called Throws: IllegalAddException - if any item in the collection already has a parent or is of an illegal type. addContent public Document addContent(int index, Content child) Inserts the child into the content list at the given index. Specified by: addContent in interface Parent Parameters: index - location for adding the collection child - child to insert Returns: the parent on which the method was called Throws:
天际的海浪 2018-01-31
  • 打赏
  • 举报
回复
引用 4 楼 weixin_39868476 的回复:
[quote=引用 3楼天际的海浪 的回复:]在页面上有个form的name叫addcontent。 <form name="addcontent"> js中就可以用 document.addcontent 访问这个form元素
特别感谢、我还想问一下document后面可以直接跟哪些属性找到那个元素[/quote] 最通用的方法是 document.getElementById("要获取元素的id")
weixin_39868476 2018-01-31
  • 打赏
  • 举报
回复
引用 3楼天际的海浪 的回复:
在页面上有个form的name叫addcontent。 <form name="addcontent"> js中就可以用 document.addcontent 访问这个form元素
特别感谢、我还想问一下document后面可以直接跟哪些属性找到那个元素
weixin_39868476 2018-01-31
  • 打赏
  • 举报
回复
引用 2楼xiaofeng3212 的回复:
有1个元素的id为addcontent
谢谢、后来明白了、是那个表单的name属性是addcontent
天际的海浪 2018-01-31
  • 打赏
  • 举报
回复
在页面上有个form的name叫addcontent。 <form name="addcontent"> js中就可以用 document.addcontent 访问这个form元素
xiaofeng3212 2018-01-31
  • 打赏
  • 举报
回复
有1个元素的id为addcontent

87,920

社区成员

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

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