SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Textarea key press disables dropdown add in firefox

    My script works ok in IE but not in firefox.
    Basically i have a dropdown list that onclick adds the values to a textarea field on same page.
    It works ok if you just select from the dropdown to begin.However as soon as you press a key with the cursor in focus of the textarea it disables the further addition from the dropdown.
    This doesn't happen in IE so it's probably a syntax error.
    I'm new to all this and i search the internet to build the scripts by trial and error -this is my way of learning.
    Anyway here is the code;

    javascript:

    function test(){
    document.getElementById('taid').innerHTML+=document.getElementById
    ('selid').value;
    var seloption = document.getElementById('selid');
    seloption.selectedIndex=0;
    }

    html:

    SELECT id="selid" onclick="return test()"

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's ok.It's sorted.The problem was with 'innerHTML'. I changed this to 'value'.
    Now works.


Tags for this Thread

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
  •