Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-19-2009, 03:26 AM   PM User | #1
Stephanie953
New to the CF scene

 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Stephanie953 is an unknown quantity at this point
Newbie Needing Help (Exit Window)

When you open and then close Exit.html it should open up ExitWindow.html and show the window with sponsors. No scroll bar and no resizing. It's not working correctly. Also I was wondering if there was a shorter code to get the scroll bar and no resizing on.

Exit.html

Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtmll/DTD/xhtmll-strict.dtd">
<html xmls="http://www.w3.org/1999/xhtml">
<head>
<title>Exit</title>
<meta http-equiv-"content-type" content="text/html;
charset=iso-8859-1" />
<script type="text/javascript">
/* <![CDATA[ */
/*
Stephanie
February 18th, 2009
Case Project 4-2
*/
/* ]]> */
</script>
</head>

<body onunload="window.open('ExitWindow.html')">
<h1>You may now exit this window.</h1>
</body>
</html>

ExitWindow.html

Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtmll/DTD/xhtmll-strict.dtd">
<html xmls="http://www.w3.org/1999/xhtml">
<head>
<title>Exit Window</title>
<meta http-equiv-"content-type" content="text/html;
charset=iso-8859-1" />
<script type="text/javascript">
/* <![CDATA[ */
/*
Stephanie
February 18th, 2009
Case Project 4-2
*/
/* ]]> */


var partnerSite;
function openLink(link) {
var winWidth = screen.width;
var winHeight = screen.height;
var winOptions = "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no";
winOptions += ",width=" + winWidth;
winOptions += ",height=" + winHeight;
partnerSite = window.open(link, "partnerSite", winOptions);
partnerSite.focus();
}

</script>
</head>
<body>


<h1>Thanks For Visiting!</h1>
<p>Be sure to visit our partner Web sites:</p>
<ul>
<li><a href="http://www.steeleraddicts.com" onclick="openLink('http://www.steeleraddicts.com');">Steeler Addicts</a></li>
<li><a href="http://www.steelers.com" onclick="openLink('http://www.steelers.com');">Pittsburgh Steelers</a></li>
<li><a href="http://www.pensunderground.edu" onclick="openLink('http://www.pensunderground.com');">Pens Underground</a></li>
<li><a href="http://www.pittsburghpenguins.com" onclick="openLink('http://www.pittsburghpenguins.com');">Pittsburgh Penguins</a></li>
<li><a href="http://www.espn.com" onclick="openLink('http://www.espn.com');">ESPN</a></li>
</ul>
<input type="button" value="Close Window" onclick="window.close()" />
</body>

</html>
This is the part I am talking about making smaller:

Quote:
var winWidth = screen.width;
var winHeight = screen.height;
var winOptions = "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no";
winOptions += ",width=" + winWidth;
winOptions += ",height=" + winHeight;
partnerSite = window.open(link, "partnerSite", winOptions);

Thanks so much!
Stephanie953 is offline   Reply With Quote
Old 02-19-2009, 04:05 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You can't really make it *THAT* much smaller, so just turn it into a function, instead:
Code:
<head>
<script language="JavaScript">
function popup( )
{
    var winOptions = "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,"
                        + "width=" + screen.width + ",height=" + screen.height;

    window.open("ExitWindow.html", "partnerSite", winOptions);
}
</script>
</head>
<body onUnload="popup( );">
...
Hope you realize that this is indeed a *classic* popup, of exactly the kind that many people's popup blockers *WILL* block. Depends on how strict they have their settings.

Oh...and I'm not sure screen.width and screen.height work for all browsers, but it won't hurt to try them.
Old Pedant is offline   Reply With Quote
Old 02-19-2009, 05:42 AM   PM User | #3
Stephanie953
New to the CF scene

 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Stephanie953 is an unknown quantity at this point
So I stick that into ExitWindow.html? Sorry still trying to get a grasp of this stuff. Thanks you so much for the reply. I really appreciate it.
Stephanie953 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:05 AM.


Advertisement
Log in to turn off these ads.