DOM script not working in IE

Discussion in 'Javascript' started by Q1tum, Feb 22, 2006.

  1. Q1tum

    Q1tum Guest

    Hi all, I have a problem with my script, I'm using javascript DOM to
    update my page.

    The getPortals() function updates a select list whichs shows portals.

    The doUpdate() function updates a portal and after that it re-builds
    the select list by calling the getPortals function at the end of the
    update function.

    This is working in Opera (without the alert() at the doUpdate()
    funtion), but it is not working correct in Internet Explorer, It only
    updates it just one times after that the update is not made in IE, I
    have checked with alerts that the doUpdate() script is calling the
    script.

    Now the wird part, if I put an alert() after I called the doUpdate()
    function and updated the field (see the script below) it is working in
    IE but no longer in Opera :S.

    Perhaps I'm doing something wrong?

    Regards,

    Arno

    Part of the Script:
    ------------------------------------------------------------

    function getPortals() {
    var url = 'libs/xml/getPortals';

    http.open('get', url, true);
    http.onreadystatechange = handlePortals;
    http.send(null);
    }

    function handlePortals()
    {
    if(http.readyState == 4)
    {
    var sl = document.getElementById('portal');
    sl.options.length = 0;

    var xml = http.responseXML.getElementsByTagName('data')[0];
    var num = xml.childNodes.length;

    if(xml.getElementsByTagName('content')[0].firstChild.data !=
    'null')
    {
    for(i=0;i<num;i++)
    {
    sl.options[sl.length] = new
    Option(xml.getElementsByTagName('content').getElementsByTagName('name')[0].firstChild.data,
    xml.getElementsByTagName('content').getElementsByTagName('id')[0].firstChild.data);
    }
    }
    }
    }

    function doUpdate() {
    var url = 'libs/xml/update';
    var frm = document.forms['update'];

    http.open('get',
    url+'?id='+frm.id.value+'&name='+frm.name.value+'&keyword='+frm.keyword.value+'&pagetext1='+frm.pagetext1.value+'&pagetext2='+frm.pagetext2.value+'&linktext='+frm.linktext.value+'&barcodetext='+frm.barcodetext.value,
    true);
    http.send(null);

    document.getElementById('page').style.visibility = 'hidden';
    //alert('Portal Updated');

    getPortals();
    }

    ------------------------------------------------------------
    Q1tum, Feb 22, 2006
    #1
    1. Advertising

  2. Q1tum

    Q1tum Guest

    Seems that it is not allowed to call getPortals(); within the doUpdate
    function :S

    I have removed the getPortals(); at the end and added a button that
    calls the getPortals(); function.

    This seams to work fine.

    But I want the list to be updated authomaticlly, anyone got any ideas?
    Q1tum, Feb 22, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thorsten Meininger
    Replies:
    0
    Views:
    434
    Thorsten Meininger
    Jul 28, 2004
  2. Thorsten Meininger
    Replies:
    0
    Views:
    498
    Thorsten Meininger
    Jul 28, 2004
  3. mike
    Replies:
    1
    Views:
    1,113
    Martin Honnen
    Nov 20, 2004
  4. Replies:
    0
    Views:
    538
  5. lawrence
    Replies:
    8
    Views:
    237
    lawrence
    May 5, 2004
Loading...

Share This Page