| javascript判断网页中某个id是否存在的例子 |
| 来源:
发布时间:2008-07-23 发布人:
浏览:
人次
字体:
[大
中
小]
|
|
如何在javascript中判断网页中某个id是否存在呢?来看看下面的实例吧! <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="robots" content="index, follow" /> <meta name="googlebot" content="index, follow" /> <title> IT知道网itwis.com--网页javascript特效集合</title> <link rel="stylesheet" type="text/css" href="" media="all" /> <script type="text/javascript"> function exist(id){ var s=document.getElementById(id); if(s){return true} else{return false} } window.onload=function(){ alert(exist("wrapper")); alert(exist("111")) } </script> </head> <body> <div id="wrapper"></div> </body> </html>
| |
| |
|
|
|
|
| §最新评论:(评论内容只代表网友观点,与本站立场无关!) | |
|
|
|
|
| 注意:请勿在本站发布政治话题、色情及违反法律的内容。 |
IT知道网 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。 |