Welcome to WebmasterWorld Guest from 54.162.12.134

Forum Moderators: open

Message Too Old, No Replies

popups and ns / mozilla

     
12:27 pm on Feb 13, 2003 (gmt 0)

10+ Year Member



hi to all,

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

2:47 pm on Feb 13, 2003 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Can you post a link(with the url widgetized) so we can see how you are calling the function.
3:40 pm on Feb 13, 2003 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



In the settings variable that you are using to declare window features, there is one difference between browsers. IE uses top= and left= but Netscape uses screenX= and screenY= -- so you need to list both to catch all browsers.

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.

6:23 am on Feb 14, 2003 (gmt 0)

10+ Year Member



thanx for the replies,

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]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month