...

View Full Version : Button Onclick Event Passing Value to Variable



RSH17
11-09-2004, 01:31 AM
Reference: IE 6 & JavaScript

I wish to use a button's onclick event to pass the button's value to a variable.

How do I code for this?

Willy Duitt
11-09-2004, 01:43 AM
Try this:



<script type="text/javascript">
var buttonValue;
</script>
</head>

<body>
<form>
<input type="button" value="myButton" onclick="buttonValue=this.value"
onmouseover="window.status=buttonValue;return true"
onmouseout="window.status=buttonValue;return true">
</form>


.....Willy

RSH17
11-09-2004, 10:46 PM
Thank you - I see how that works. But I'm still at a loss. The variable I need to access is switch statement variable "var Article" and the switch statement is inside of a function "change()". If you can follow the link below, you can see the code. How do I code to put the button's value into the variable "Article" using the button's onclick event?

http://www.codingforums.com/showthread.php?t=47127



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum