luweifeng1983 发表于 2013-2-7 15:02:25

js判断对象是否存在

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>javascript object</title>
<body>
<input id="aaa">
<input type=buttonvalue="checkaaa">
<input type=buttonvalue="checkother">

<script language="javascript">
<!--
function check(strObj)
{
if(typeof(eval("document.all."+strObj))!= "undefined")
{
alert(strObj +" is an object");
}
else
{
alert(strObj +" is not an object");
}
}
//-->
</script>
</body>
页: [1]
查看完整版本: js判断对象是否存在