C
chimpoid
Hi there,
I have a minor problem with IE updating an i-frame withing a page.
It's straightforward enough. A hidden i-frame reloads and runs a php
script which downloads a listing from a MySQL databse and then cals a
javascript to transfer the content to another visible i-frame thus
preventing any reload flicker.
The code is as follows:
// Code
function insertusers(usersinput){
if(window.frames && window.frames["usersin"]) //IE 5 (Win/Mac),
Konqueror, Safari
aWindow = window.frames["usersin"];
else if(document.getElementById("usersin").contentWindow)
//IE
5.5+, Mozilla 0.9+, Opera
aWindow =
document.getElementById("usersin").contentWindow;
else //Moz < 0.9 (Netscape 6.0)
aWindow = document.getElementById("usersin");
if(aWindow.document) //Moz 0.9+, Konq, Safari, IE, Opera
aDocument = aWindow.document;
else //Moz < 0.9 (Netscape 6.0)
aDocument = aWindow.contentDocument;
var neweDiv = aDocument.createElement("DIV");
neweDiv.innerHTML = usersinput;
a = aDocument.getElementById("userthings")
b = aDocument.getElementById("neweDiv")
go = a.removeChild(b);
aDocument.getElementById("userthings").appendChild(neweDiv);
}
// End Code
The content works fine in mozilla and runs as expected dropping the
contents of usersinput (in the head of the function) as a child of the
div in 'a'.
In IE the error returned is: 'a' null or not an object
I have used alert to check that it is readin everything correctly as
far down as aDocument. I have also checked and the div userthings
exists and should be reading correctly but IE seems to balk at this and
kill the script.
Any thoughts would be most appreciated
Chimp
I have a minor problem with IE updating an i-frame withing a page.
It's straightforward enough. A hidden i-frame reloads and runs a php
script which downloads a listing from a MySQL databse and then cals a
javascript to transfer the content to another visible i-frame thus
preventing any reload flicker.
The code is as follows:
// Code
function insertusers(usersinput){
if(window.frames && window.frames["usersin"]) //IE 5 (Win/Mac),
Konqueror, Safari
aWindow = window.frames["usersin"];
else if(document.getElementById("usersin").contentWindow)
//IE
5.5+, Mozilla 0.9+, Opera
aWindow =
document.getElementById("usersin").contentWindow;
else //Moz < 0.9 (Netscape 6.0)
aWindow = document.getElementById("usersin");
if(aWindow.document) //Moz 0.9+, Konq, Safari, IE, Opera
aDocument = aWindow.document;
else //Moz < 0.9 (Netscape 6.0)
aDocument = aWindow.contentDocument;
var neweDiv = aDocument.createElement("DIV");
neweDiv.innerHTML = usersinput;
a = aDocument.getElementById("userthings")
b = aDocument.getElementById("neweDiv")
go = a.removeChild(b);
aDocument.getElementById("userthings").appendChild(neweDiv);
}
// End Code
The content works fine in mozilla and runs as expected dropping the
contents of usersinput (in the head of the function) as a child of the
div in 'a'.
In IE the error returned is: 'a' null or not an object
I have used alert to check that it is readin everything correctly as
far down as aDocument. I have also checked and the div userthings
exists and should be reading correctly but IE seems to balk at this and
kill the script.
Any thoughts would be most appreciated
Chimp