Log in

View Full Version : Help With ECMAScript



NGJ
05-25-2006, 09:52 AM
I was kindly given this snippet of code (by TWEY) that takes a value and passes it - so you can, say, take an input from a user and then display that value back within a form.

<input type="text" onchange="document.getElementById('pine').innerHTML = this.value;">
<!-- ... -->
<p id="pine">


Problem I'm faced with is that it only seems to recall the value the once. If if refer to it again, it seems to return a blank.

Can anyone please suggest what I should do here? :confused:

Thanks in advance,

N.

Twey
05-25-2006, 10:30 AM
To add more elements, insert them in the onchange like so:
<input type="text" onchange="document.getElementById('pine').innerHTML = document.getElementById('fir').innerHTML = document.getElementById('poplar').innerHTML = this.value;">

NGJ
05-25-2006, 01:03 PM
I see! Good stuff.

Thanks again!:)