DOM script not working in IE

Q

Q1tum

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();
}

------------------------------------------------------------
 
Q

Q1tum

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top