Results 1 to 2 of 2

Thread: innerHtml IE7

  1. #1
    Join Date
    Nov 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default innerHtml IE7

    Hello all,

    I have recently made an application in which I am using "innerHtml" to fill "option" of dropdown
    document.getElementById('list').innerHTML=arr[0];
    here "list" is the id of the <select>,

    It is working fine on all browsers except IE7,

    Please help me in this problem .

    i know innerHtml don't work on IE7 , but what is the alternative to do this task ,
    please help me

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    See:

    http://www.mredkj.com/tutorials/tutorial005.html

    or you could use DOM level 2 methods (just something I threw together):

    Code:
    function popsel(){
    var oMake = function(v, t){
    var o = document.createElement('option');
    o.value = v;
    o.appendChild(document.createTextNode(t));
    document.getElementById('list').appendChild(o);
    }, l = ['one', 'two', 'three'];
    for(var i = 0; i < l.length; ++i)
    oMake(i + 1, l[i]);
    }
    HTML Code:
    <input type="button" onclick="popsel();"><br>
    <select id="list">
    
    </select>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •