PDA

View Full Version : Help with code for pop up window



tricky
12-11-2009, 03:05 PM
Hi Sorry not sure if this is in the right place but here goes what i am trying to do is create a pop (Already done) but now what i would like to do is give people the chose of where to go when it closes example <go here> <or here> then it loads in the main screen not the pop up bit like a confirm button but i would like it to be multiple choice rather then just close is this possible?

Any help would be gratefully received

twQ
12-11-2009, 05:42 PM
Could you post the pop up code so it can be modified? I'm not sure here, but is it something as simple as put this in the buttons tag:


onClick="window.location='PUT_LINK_HERE';"

If I'm misunderstand let me me know, I'm going the simple route instead of overthinking it :p

Tim

tricky
12-11-2009, 08:10 PM
that's what i tried but it opens in the same window as the pop up thanks though,
all the pop up does is give a little message here is the code


<body>
<body bgcolor="000000">
<center>
<applet CODE="ProScroll" WIDTH="500" HEIGHT="60">
<param name="TEXT"
value="$ #bold##cyan#HAPPY NEW YEAR TO ALL OUR CHATTERS, THANK YOU FOR MAKING THIS ROOM SUCH A GREAT PLACE TO COME TO CHAT AND MEET PEOPLE, WE WISH YOU ALL THE BEST FOR #red#2#green#0#blue#1#yellow#0 #cyan#LETS HOPE WE CAN KEEP IT GOING">
<param name="STYLE" value="bold">
<param name="SIZE" value="22">
<param name="SPEED" value="fast">

</applet>
<br>
<APPLET CODE="Firework.class" WIDTH="500" HEIGHT="340">
<PARAM NAME="AnimationSpeed" VALUE="50">
<PARAM NAME="RocketSoundtrack" VALUE="fire.au">
<PARAM NAME="RocketStyleVariability" VALUE="10">
<PARAM NAME="MaxRocketNumber" VALUE="9">
<PARAM NAME="MaxRocketExplosionEnergy" VALUE="850">
<PARAM NAME="MaxRocketPatchNumber" VALUE="90">
<PARAM NAME="MaxRocketPatchLength" VALUE="68">
<PARAM NAME="Gravity" VALUE="400">
</applet>
<br>
<input type="button" value="plain" onClick="window.location='http://www.sunflowerspetal.com/chatroom1.html';">
<input type="button" value="Sunflower" onClick="window.location='http://www.sunflowerspetal.com/chatroom2.html';">

Hope that helps

tricky
12-11-2009, 08:20 PM
P.S i was also toying with the idea of making it a timed window bit like a intro page but only as a pop up sorry if i sound a novice it's probably cause i am just looking to learn

twQ
12-12-2009, 01:03 AM
I believe this might be what your looking for:



<input type="button" value="plain" onClick="window.open('http://www.sunflowerspetal.com/chatroom1.html');">
<input type="button" value="Sunflower" onClick="window.open('http://www.sunflowerspetal.com/chatroom2.html');">

More info on the window.open object: http://www.w3schools.com/jsref/met_win_open.asp


Let me know if its not, and hey I'm not exactly an expert here we all gotta learn. Also if your still interested in the timer thing let me know and I'd be glad to help you with that.

Tim

tricky
12-12-2009, 04:22 AM
Thanks Tim been a great help

OK getting on the right lines thanks i think it might be better though for the timed one as the pop up didn't close on clicking

jscheuer1
12-12-2009, 05:28 AM
Put all of these files in the same folder:

index.htm:
_______________

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body>
<a href="popup.htm" target="_blank" onclick="window.open(this.href, this.target, 'width=300, height=300');return false">Pop</a>
</body>
</html>

popup.htm:
_______________

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function closeLaunch(url){
if(!self.opener){
return true;
}
self.opener.location.href = url;
self.close();
return false;
}
</script>
</head>
<body>
<div>
<a href="somePage.htm" onclick="return closeLaunch(this.href);">Some Page</a><br>
<a href="anotherPage.htm" onclick="return closeLaunch(this.href);">Another Page</a>
</div>
</body>
</html>

somePage.htm:
_______________

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body>
<div>
Some Page
</div>
</body>
</html>

anotherPage.htm:
_______________


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body>
<div>
Another Page
</div>
</body>
</html>

Any questions?

tricky
12-12-2009, 11:02 AM
thanks John

Sadly yes one quetion does this mean i have to re write all the pages or can i juat add what you have written to them and do i need to keep them in the same folder? Or can they be moved and the URL changed

jscheuer1
12-12-2009, 12:42 PM
I don't see how that's sad. :)

Perhaps some or all of the pages must be on the same domain. The ones in my example must be in the same folder though, only because they reference each other. As long as the URLs used for the links are valid, things should be fine.

I wrote my HTML code to be valid to the DOCTYPEs used for each, though unless your code is extremely invalid, browsers will ignore minor deviations from the standards. The important parts are the javascript code in the onclick events and the one script. These javascript codes may (all or some) be external to the pages if you like, and this is generally recommended (javascript should be external), but not necessary.

Basically these pages are just templates. You may either add to them or lift the javascript from them to apply as required to your existing pages.

If you have a problem doing either:

Please post a link to the pages on your site that contain the problematic code so we can check it out.

tricky
12-12-2009, 07:39 PM
Thanks John

Seems to be working great thank you for the assistant guys feel free to see you work in action this is just the prototype mind the full version won't be around till after christmas (I like to get things sorted early) www.sunflowerspetal.com/newyear/popuptest.html if there are any errors feel free to let me know i always welcome comments good or bad they all help :)