So I have 6 buttons and when they are clicked I need a textbox to be populated with each of the buttons values.
Here is the code I have so far:
I should mention that this is all encapsulated within a function that is called when the user clicks on a button. And obviously the textbox does populate but not with the current button's value, unless you click on the last button. And these "buttons" I refer to are spans with onclick hence why I'm using innerHTML.Code:for(var i = 1; i<=6; i++) { var med = document.getElementById('med'+i).innerHTML; document.getElementById('TextBox1').value = med; }
In Flash I would do it like this:
But the textbox populates with "undefined."Code:for(var i = 1; i<=6; i++) { var med = document.getElementById('med'+i); med.ih = med.innerHTML; document.getElementById('TextBox1').value = this.ih; }
Thanks again for everybody's help![]()



Reply With Quote

Bookmarks