drsmartman
04-15-2004, 05:39 PM
Having trouble getting some JS to work in different browsers. IE 5.5/6 and Netscape 7+ seem to work good.
I actually solved the functionality problem on this forum and am hoping to get some on the cross browser issue....the main problem is getting references to frame/window events and variables.....does the code below look okay? How to improve for universal compatibility (is there a best practice for calling/setting variables or events in another frame?)?
---part of script from mainWindow
parent.loc = new Array("link1","link2","link3");
parent.buyWindow.location.reload();
---
----part of script from main frame (parent frame)
<script language="JavaScript">
var loadedPage="0";
var loc = new Array();
var messageShown="false";
var onlineBuy="false";
function openUrls() {
if(loadedPage<loc.length) {
parent.buyWindow.location=loc[loadedPage];
loadedPage++;
}
if(loadedPage==loc.length && loc.length>0 && loadedPage>0 && messageShown=="false" && onlineBuy=="true"){
window.open("link");
messageShown="true";
}
}
</script>
---------
----frame source
<frameset rows="0,*">
<frame src="buy.html" name="buyWindow" onLoad="parent.openUrls()" NORESIZE>
<frame src="registration.php?cf=2" name="mainWindow">
</frameset>
------
Any help to get this working on other browsers is helpful....
I actually solved the functionality problem on this forum and am hoping to get some on the cross browser issue....the main problem is getting references to frame/window events and variables.....does the code below look okay? How to improve for universal compatibility (is there a best practice for calling/setting variables or events in another frame?)?
---part of script from mainWindow
parent.loc = new Array("link1","link2","link3");
parent.buyWindow.location.reload();
---
----part of script from main frame (parent frame)
<script language="JavaScript">
var loadedPage="0";
var loc = new Array();
var messageShown="false";
var onlineBuy="false";
function openUrls() {
if(loadedPage<loc.length) {
parent.buyWindow.location=loc[loadedPage];
loadedPage++;
}
if(loadedPage==loc.length && loc.length>0 && loadedPage>0 && messageShown=="false" && onlineBuy=="true"){
window.open("link");
messageShown="true";
}
}
</script>
---------
----frame source
<frameset rows="0,*">
<frame src="buy.html" name="buyWindow" onLoad="parent.openUrls()" NORESIZE>
<frame src="registration.php?cf=2" name="mainWindow">
</frameset>
------
Any help to get this working on other browsers is helpful....