HI,
I have this line in my html:
Code JavaScript:<input type="button" value="edit" value="<?php echo $message_id; ?>" onClick="get_message();" />
Now the value of the input above is being generated by a php script and is as always a number....theres about 10 of these spit out by the server so it ends up looking like this:
and so on.Code JavaScript:<input type="button" id="message_id"value="edit" value="1" onClick="get_message();" /> <input type="button" id="message_id" value="edit" value="2" onClick="get_message();" /> <input type="button" id="message_id" value="edit" value="3" onClick="get_message();" />
Now i have this function ( its actually an ajax function but i only need to ask about the first line of it which is javascript!!) that is currently being run when the button is clicked:
Now what i want to happen is for the id that is being generated in the value of the input to make it in to the get_message() function. At present whatever button you click on only the number 1 ever makes it to the script.Code JavaScript:function get_message() { var message_id = document.getElementById("message_id").value; createRequest(); var url = "edit_message.php?message_id=" + escape(message_id); request.open("GET", url, true); request.onreadystatechange = open_message; request.send(null); }
I need a way to get the value of whatever button has been clicked in to my message_id variable.
Any ideas?
![]()




)
Bookmarks