将变量传递给函数
问题描述:
它的一种愚蠢的问题。但我不知道我犯了什么错误。如果有人可以帮助。将变量传递给函数
<html>
<head>
<script type="text /vbscript">
function zips(s)
document.write(s)
end function
</script>
</head>
<body>
<script type="text/vbscript">
dim x,y
x="sushant"
<button onclick="zips(x)" id=button1 name=button1>clickme</button>
</script>
</body>
</html>
对不起,我不知道如何格式化它。但我没有得到所需的输出。任何帮助非常赞赏
答
您的button
标签应该是以外的script
标签。
<script type="text/vbscript">
dim x,y
x="sushant"
</script>
<button onclick="zips(x)" id=button1 name=button1>clickme</button>
该按钮不是脚本的一部分,而是HTML的一部分。
+1:不错的选择:) – Sarfraz 2010-04-01 08:46:54
噢。感谢名单。这是一个愚蠢的错误。 – sushant 2010-04-01 08:48:48