怎么判某个id是否存在???? 80高分等待 if(document.getElementById(str)){ //do something} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function yul(str){if (document.all(str)) alert('存在');else alert('不存在')}1)document.all(str) 亦可改为item方法 2)document.all.item(str)dom方法最通用3)document.getElementById(str) var o=document.all('yourid')if(typeof(o)=="undefined"||o==null)alert('no found'); 用阿信的方法没错:typeof 运算符把类型信息当作字符串返回。typeof 返回值有六种可能:"number"、"string"、"boolean"、"object"、"function" 和 "undefined"。 推荐typeof的方法,偶比较常用 请问html的技术高低影响jsp学习吗? 请前辈指教JavaScript学习教材和过程 一个超简单的问题,判断acess表单中含有特定字符的字段所在的行变为红色!!! 关于google自定义搜索的搜索样式问题 点击按钮在嵌套框架内如何跳转? 页面跳转的个问题 js表单日期选择 关于如何在JS中读取<%%>中变量的问题 关于qqshow图片的问题 刚才没说清楚,这次争取说清楚一点 表单提交问题 父窗口中onkeydown后弹出子窗口,在子窗口中得到父窗口中text中的值?
if (document.all(str))
alert('存在');
else
alert('不存在')
}1)document.all(str) 亦可改为item方法
2)document.all.item(str)dom方法最通用
3)document.getElementById(str)
if(typeof(o)=="undefined"||o==null)alert('no found');
typeof 返回值有六种可能:"number"、"string"、"boolean"、"object"、"function" 和 "undefined"。