开发者

passing variable to a function

开发者 https://www.devze.com 2022-12-25 14:11 出处:网络
its kind of silly question. but i dont know what mistake i am making. if any one could help. <html>

its kind of silly question. but i dont know what mistake i am making. if any one could help.

<html>  
<head>  
<script type="text /vbscript">  
function zips(s)  
  document.write(s)  
end function   
</script>  
</head>  

<body>  
<script type="text/vbscript">  
 dim x,y  开发者_JAVA百科
 x="sushant"  
<button onclick="zips(x)" id=button1 name=button1>clickme</button>  
</script>  
</body>  
</html>  

sorry i dont know how to format it. but i am no getting the desired output. any help is very much appreciated


Your button tag should be outside of the script tag.

<script type="text/vbscript">  
 dim x,y  
 x="sushant"  
</script>  
<button onclick="zips(x)" id=button1 name=button1>clickme</button>  

The button is not part of the script but part of the HTML.

0

精彩评论

暂无评论...
验证码 换一张
取 消