homepage Welcome to WebmasterWorld Guest from 54.81.170.186
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
popups and ns / mozilla
g00fy




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

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

 

korkus2000




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

Can you post a link(with the url widgetized) so we can see how you are calling the function.

tedster




msg:1483730
 3:40 pm on Feb 13, 2003 (gmt 0)

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.

g00fy




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

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]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved