Results 1 to 3 of 3

Thread: Help With ECMAScript

  1. #1
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Help With ECMAScript

    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?

    Thanks in advance,

    N.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    To add more elements, insert them in the onchange like so:
    Code:
    <input type="text" onchange="document.getElementById('pine').innerHTML = document.getElementById('fir').innerHTML = document.getElementById('poplar').innerHTML = this.value;">
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I see! Good stuff.

    Thanks again!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •