|
#1
| ||||
| ||||
| javascript issue (how have i never had this problem before?) Hey all, I find it completely bizarre how I have never came across this problem yet. What I am trying to do is change text dynamically with Javascript. I want to make a Javascript function that changes some (without being in a form element). the text right now is IN a div, so maybe I can work it like that? Thanks for your help... |
|
#2
| |||
| |||
| Here's the solution <div id="mydiv"> text that will change </div> <script language="javascript"> function changetext(newtext){ document.getElementById('mydiv').innerHTML = newtext } </script> You have the div with it's own id and the function that changes the text. now you only have to use that function applied in a button, a link, etc. passing the new text as a parameter. hope it helps. |
|
#3
| ||||
| ||||
| perfect thanks alot, Im sure this is cool across most nbrowsers, right? Ive never seen 'innerHTML' before. |
|
#4
| |||
| |||
| yes, it works with browsers version 5 and up |