PDA

View Full Version : HELP: How do i make this more cross-browser compatible???


SpeedFreak
11-10-2002, 03:03 AM
ok,

i have a javascript that generates a popup window:

<script language="javascript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable= 0'
win = window.open(mypage,myname,settings)
}
</script>


it is called via a link (in an imagemap):

<area shape="rect" coords="90,3,493,45" href="javascript:null()" onclick="NewWindow('loading.html','name','800','600','no');return false" target="main">


I have had some comments from people saying it is not working on their systems. What i want to know is, is there anything i can do to make this more cross-browser compatible??

Thanks

Chris Johnson
Manager - www.blueshiftdesigns.com

SpeedFreak
11-10-2002, 09:11 PM
anybody? :confused:

joh6nn
11-10-2002, 09:32 PM
<script language="javascript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll) {
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
win = window.open(mypage,myname,'scrollbars='+scroll) // just reducing your code length here
win.moveTo(LeftPosition, TopPosition); // moves the window in a fairly cross-browser way
win.resizeTo(w, h); // resizes the window in a fairly cross-browser way
}
</script>