请教eval的问题!

zl13 2004-11-24 10:42:42
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<script language=javascript>
function testformload(id)
{
test(id)
}
</script>
<script language=vbscript>
Sub test(id)
Dim divid
divid = Eval(id)
divid.style.display = "none"
End Sub
</script>
<body>
<form name=form1>
<div id="001">aaa</div>
<div id="002">bbb</div>
<select name=sel id=sel onchange="testformload(form1.sel.value)">
<option value=001>001</option>
<option value=002>002</option>
</select>
</form>
</body>
</html>

提示我divid缺少对象
...全文
94 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lienzhu 2004-11-25
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<script language=javascript>
function testformload(id)
{
document.all(id).style.display = "none"
}
</script>
<body>
<form name=form1>
<div id="001">aaa</div>
<div id="002">bbb</div>
<select name=sel id=sel onchange="testformload(form1.sel.value)">
<option value=001>001</option>
<option value=002>002</option>
</select>
</form>
</body>
</html>
回复
haor 2004-11-24
Sub test(id)
Dim divid
document.all(id).style.display = "none"
End Sub
应该是这个意思吧?
回复
haor 2004-11-24
郁闷,没看懂你想要干什么
回复
guoweidong 2004-11-24
<script language=vbscript>
Sub test(id)
dim divid
divid = Eval(id)
msgbox divid
//divid.style.display = "none"
End Sub
</script>

取到的是一个值,不是对象.
回复
发动态
发帖子
JavaScript
创建于2007-09-28

8.4w+

社区成员

Web 开发 JavaScript
申请成为版主
社区公告
暂无公告