1) Script Title: DHTML Window
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...htmlwindow.htm
3) Describe problem:
Ok I have modified the code of the load window to load the window at the location of the x and y co-ordinate. It works like a real gem in IE. However it just gives me a blank grey window in Mozilla FF.
The reason for this is that mozilla does not seem to understand "event.clientx" (if I get rid of that line the window will appear in Mozilla)
So i have 2 questions:
1) How can i adequately test for whether the browser is Mozilla? (there is already functionality in teh code to test for IE5 and Netscape 6), how can I adjust it to also test for Mozilla FF?
2) How can I get the equivalent of clientX for Mozilla users?
Here is the relevant snippet of the code:
Code:
function loadwindow(sURL){
var url = "http://www.google.com"
var width = 320
var height = 310
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left=event.clientX+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+event.clientY+"px" : iecompattest().scrollTop*1+event.clientY+"px"
//document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
}
Question 1 is more important really, I am happy to just have the window appear centered but not error for the 20% of users that use Mozilla FF.
Bookmarks