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')[i].getElementsByTagName('name')[0].firstChild.data,
xml.getElementsByTagName('content')[i].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.page text1.value+'&pagetext2='+frm.pagetext2.value+'&li nktext='+frm.linktext.value+'&barcodetext='+frm.ba rcodetext.value,
true);
http.send(null);
document.getElementById('page').style.visibility = 'hidden';
//alert('Portal Updated');
getPortals();
}
------------------------------------------------------------