I am trying to call a function from a link or button like the example below, however I would like to call the function whilst passing a variable along (not a string).
I was wondering if this was even possible, if not what is another solution?
This isn't my code, it is a simple way of explaining what I am trying to do.
<html>
<head>
<script type="text/javascript">
function myfunction(txt){
alert(txt)
}
</script>
</head>
<body>
<form>
<input type="button" onclick="myfunction('Java!')" value="Java">
<input type="button" onclick="myfunction('Java too!')" value="Java too">
</form>
</body>
</html>
So instead of 'java too!' I would have a variable named "category" which could contain different data each time the button is pressed.
Hope this makes sense.
Any help would be kindly appreciated.
Cheers
Danny