Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Beginner
Jan 11, 2002

A New Way to Deal with Popup Windows


When creating a popup window from a hyperlink or button, I often get an error because I try to do it myself and the author has hard coded the same behavior. A little consideration for advanced users will avoid irritating them.

Instead of:
 
<a onclick="window.open('somepage.htm')">Prompt</a>

Use this:
 
<a onclick="javascript: window.open(this.href);"
href="somepage.htm">Prompt</a>

This is another way:
 
<a onclick="javascript: return showWin(this.href);"
href="somepage.htm">Prompt</a>

<script language="javascript" src="showWin.js"_
></script>

showWin.js:
function showWin(href) {
	window.open(href, "myWin",
"width=780,height=540,left=10,top=10,status=no,toolbar=yes,_
menubar=no,loca
tion=no,scrollbars=yes,resizable=yes",false);
	return false;
}
Brian McNamara
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date