Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Event Handler Question Control Array 1

Status
Not open for further replies.

Custom24

Programmer
Nov 27, 2001
591
GB
Hi
What I'm trying to do is simple for jscript, but I need to use vbscript.

In a web page, I've got essentially a control array which I generate from server side code. I can get the server side code to include the onclick="MySub" attribute for each element, and I know how to make the sub obtain a reference to the control which was clicked, thus kinda getting the functionality of a control array.

But it doesn't work. For example, this produces an error "Object doesn't support this property or method" when a button is clicked. Does anyone have any suggestions?

Code:
<HTML>

  <body >

    <form name=&quot;Form1&quot;>
<div id=&quot;Panel1&quot;>
<button onclick=&quot;MySub&quot;>0</button><button onclick=&quot;MySub&quot;>1</button><button onclick=&quot;MySub&quot;>2</button>
</div>
    </form>
  </body>
    <script language=vbscript>
  sub MySub
  msgbox &quot;Hello&quot;
  end sub
  </script>
</HTML>


Mark [openup]
 
Try this

<HTML>

<body >

<form name=&quot;Form1&quot;>
<div id=&quot;Panel1&quot;>
<input type=button onclick=&quot;MySub()&quot; value=&quot;0&quot;><input type=button onclick=&quot;MySub()&quot; value=&quot;1&quot;><input type=button onclick=&quot;MySub()&quot; value=&quot;2&quot;>
</div>
</form>
</body>
<script language=vbscript>
sub MySub()
msgbox &quot;Hello&quot;
end sub
</script>
</HTML>

 
Thanks for that - I'd been starting to go a bit mad!


Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top