The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Closing the Windows, 6.4. How do I create a link that opens a new window of a specific size
Number1
post Mar 25 2013, 02:03 PM
Post #1


Advanced Member
****

Group: Members
Posts: 114
Joined: 17-October 12
Member No.: 17,963



The above FAQ section seems fine, but it leaves out one crucial concern:

How to ensure that you aren't unknowingly stacking up windows behind the active ones? When you have a function, such as on most of the product pages at www.seco-larm.com, that creates a new window simply to temporarily display a blowup of a photo or diagram, it's important that that window goes away when it loses focus, or the customer can find himself inundated with these small windows.

Here's the code that accomplishes that in all but the most unusual cases.

In the Head you put the call to the external js: <CODE><script type="text/javascript" src="VideoAcc.js"></script></CODE>

and,
<CODE><script language="Javascript">
function PopLink(x){window.open("PopUps/"+x, "popups", "width=450, height=274, resizable=yes, scrollbars=no, left=200, top=200");}
function PopLink2(x){window.open("PopUps/"+x, "popups", "width=460, height=430, resizable=yes, scrollbars=no, left=200, top=200");}
</script></CODE>

and,

<code><body style="FONT-FAMILY: Tahoma, Verdana, Arial;" bgcolor=white topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 onfocus="closesrchwin()"></code>

And, in the external js "VideoAcc.js",
<code>var srchwin = false;
function opensrchwin()
{srchwin = window.open('SearchVideo.htm','mywin','resizable=yes, scrollbars=yes,width=340,height=90');
return false;}
function closesrchwin()
{if(srchwin) { srchwin.close(); srchwin = false; }}</code>

And then the window gets called via a link as:
<code><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td width=100% align=center><A HREF="java script:PopLink('4PortHub.htm');"><div class=pr><font class=size8>View Enlargement</font></div></a></td></tr></code>

This is script kiddie hacking, of course, but someone who has a greater understanding could likely make it more clear, I'm sure...

This post has been edited by Number1: Mar 25 2013, 02:06 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Christian J
post Mar 29 2013, 06:34 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,681
Joined: 10-August 06
Member No.: 7



http://htmlhelp.com/faq/ does contain a link to http://www.irt.org/script/script.htm
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 6th June 2024 - 07:30 AM