Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple small question; pop up window; correct this 1

Status
Not open for further replies.

JeroenB

Programmer
Apr 8, 2001
93
BE
Hi,

can someone help me out with this. In this message I' ve included the script of a popup window; the problem is now that I only want to let appear the main page(=popup window), by clicking on a link (for instance : plugin installed) in the start page (which has ths script). So can someone correct this script please ?

Thanks in advance
Jeroen B



<HEAD>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
netscape = &quot;main.htm&quot;; // set your browser pages
explorer = &quot;main.htm&quot;;
unknown = &quot;main.htm&quot;;

windowprops = &quot;top=0,left=0,resizable=yes&quot;
+ &quot;,width=&quot; + 635 + &quot;,height=&quot; + 740;

ns = (navigator.appName == 'Netscape');
ie = (navigator.appName == 'Microsoft Internet Explorer');
url = (!ns & !ie) ? unknown : ( ns ? netscape : explorer);
window.open(url, &quot;popupPage&quot;, windowprops);
// End -->
</script>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
</body>
</html>
 
Well, you can leave all the initialization - but take the piece of code out which actually does the opening and put it in a function called from the link.

Allthough apparently it is a good idea to clean out the global space, so any variables which don't need to be global,like windowprops - plonk them in the function too.


<script>
function newWindow(){
netscape = &quot;main.htm&quot;; // set your browser pages
explorer = &quot;main.htm&quot;;
unknown = &quot;main.htm&quot;;
windowprops = &quot;top=0,left=0,resizable=yes&quot;
+ &quot;,width=&quot; + 635 + &quot;,height=&quot; + 740;

url = (!ns & !ie) ? unknown : ( ns ? netscape : explorer);
window.open(url, &quot;popupPage&quot;, windowprops);



}
</script>

<a href=&quot;javascript:newWindow()&quot;>Open</a>
b2 - benbiddington@surf4nix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top