<input type="button" id="button1" value="test">
<script>
alert(document.getElementById("button1")==null?"button1不存在":"button1存在")
</script>
可以修改id="其它名字"看看
<script>
alert(document.getElementById("button1")==null?"button1不存在":"button1存在")
</script>
可以修改id="其它名字"看看
解决方案 »
- 用JQuery animate 做滚动图片感觉不够流畅?为啥?
- 如何用javascript 实现文件选择器,不适用<input type=file>?
- 有2位数字,如果第一位输入输入0,后面一位只能输入1-9,如果第一位输入1第二位只能输入1-2。的正则表达式?
- 如何取对象宽度
- 鼠标位置显示的问题,做成这样的,在页面的位置显示一个下拉单,这个鼠标的位置如果在下面就在上面显示这个单子,如屏幕的最左面单子就在
- 在服务器上找不到脚本语言 'JAVASCRIPT'
- 请问: document.forms[0].action="getQuestion.do?method=getQuestion";是什么意思啊??
- 在input的onfocus()时候,下面出现一个层(或是其他什么),里面是另一个页面,点上面一个一些东西,可以返回值到input里面去,怎么实现
- 怎么让Web页中的表格的表头在每页都打印出来啊?
- 高分求教:我想当下拉框中的选项被选中时触发函数,显示另外一个页面,这样写错在哪里?
- 关于日期格式规范的问题。急!
- 表单提交后在php中获得$messenge="..."(字符串)
if (e != null)
{
alert ("存在")
}
else
{
alert ("不存在")
}
....
<input id=button1>
<input id=button2><script>
function check(str){
alert(str+":"+(document.all(str)!=null?"存在":"不存在"))
}
check("button1")
check("button2")
check("button3")
</script>
<input id=button1>
<input id=button2>
<script>
function check(str){
alert(str+(document.all(str)==null?"不":"")+"存在")
}
check("button1")
check("button2")
check("button3")
</script>