Forum Moderators: open
just a little help pls :)
i have a script that works fine in ie but not in ns or mozilla (same same really:) )
i figure its not the way i'm getting window dimensions cause i have another script that resizes according to resolution that uses same method and it works in ns.
var win = null;
function NewWindow(mypage,myname,w,h,scroll,resize){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='+resize+',status'
win = window.open(mypage,myname,settings)
}
** ns gives me no response at all, and popups are enabled in the browser?
** need to fix this because most of my links use this script
thanx to all in advance
kind regards,
g00fy
However, that alone should not completely stop the window from opening. I don't quite get what the variable win is doing - I don't think it's needed. Try changing
win = window.open(mypage,myname,settings)
to
window.open(mypage,myname,settings)
If that works, just drop the line var win = null as well.
i tried the code adjustment but it didnt work :(
the url of the page is <sorry, no personal urls>
the 'contact us' & 'privacy' links to the left use this function as well as others on other pages but this will give you the idea.
im calling it with
<a href="javascript:NewWindow('contact.html','contact','350','300','no','no')" onmouseover="window.status='MaD Computing Solutions - Contact Information';return true" onmouseout="window.status='MaD Computing Solutions';return true">
as i say all links are fine in ie
this is my code now:
function NewWindow(mypage,myname,w,h,scroll,resize){ <!-- if browser is IE //-->
if (document.all){
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='+resize+',status'
window.open(mypage,myname,settings)
}
<!-- browser = NS6 //-->
else {
LeftPosition = (screen.width)? (screen.width-w)/2 : 0;
TopPosition = (screen.height)? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',screenX='+TopPosition+',screenY='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+',status'
window.open(mypage,myname,settings)
}
}
kind regards,
g00fy
[edited by: tedster at 6:43 am (utc) on Feb. 14, 2003]
[edit reason] remove url [/edit]