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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a popup that, when clicked, will open *another* popup 1

Status
Not open for further replies.

mjstone323

Technical User
Jan 11, 2002
57
US
Hello -
I am almost a total newbie to JavaScript, so I apologize if this is a no-brainer to most of you -

I'm using some script to open a popup window containing a larger picture of a thumbnail in a Flash movie. I put some script in my source:

on(release){
getURL("JavaScript:pop1();");
}


I put this action in all my thumbnail pics.
When I publish the movie, I edit the .html with this code:

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
functionpop1(){
window.open(&quot;Images/Associates/associate1.jpt&quot;,&quot;&quot;,&quot;height=400,width=300,left=100,top=100,scrollbars=1,resizable=1&quot;);
}
</script>


This works great. What I now want to do, and have been completely unable to figure out how, is to modify this script so that when the first image pops up, the visitor can click on that popup and it will either open a new browser window that contains that person's home page, or even just go to that URL within the same popup. I don't care which, just as long as they can click on the first popup and somehow get to the URL.
Can anyone help me? My head hurts. %-)
Best,
Marianne
 
it may be easier to have the larger image in a new window with the interations you want along with it. what I mean is
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
functionpop1(){
window.open(&quot;Images/Associates/associate1..htm&quot;,&quot;&quot;,&quot;height=400,width=300,left=100,top=100,scrollbars=1,resizable=1&quot;);
}
</script>

associate1.htm
<html>
<body>
<img src=&quot;larger pic&quot;>
<!-- then just add the options you need like a link -->
<a href etc...


am I making any sense or does that sound rediculous
Hope that helps
admin@onpntwebdesigns.com
 
Hi! Thanks for your reply -[thumbsup2]
No - not ridiculous - but are you suggesting that I create an entirely new html document with just the larger image in it or is there a way to do it in the same html doc as the original JS? (either way, I'm relieved to have a resolution in sight...[bigsmile])
 
Ya, that's what I meant. Then you could have the options of placing the links etc on that new page with the larger pic. The pages wouldn't be much more then what I have up there.

The only thing you would have to change in the script is what I changed up there from .jpt to .htm so it references the page.

Someone may post a easier way though. I think this may be the most functional approach considering the popup Hope that helps
admin@onpntwebdesigns.com
 
If you go this route you may want to consider placing the buttons on the window for the user and as well resize the screen to the full size. thats fairly easy to due. here's a script which you could place in the onunload so when a link is clicked it will resize the window
<script language=&quot;JavaScript&quot;>
function maxWindow()
{
window.moveTo(0,0);


if (document.all)
{
top.window.resizeTo(screen.availWidth,screen.availHeight);
}

else if (document.layers||document.getElementById)
{
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
{
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}

</script>

<body onunLoad=&quot;maxWindow();&quot;>

just a thought Hope that helps
admin@onpntwebdesigns.com
 
If you declare a name for your popup window, you can write source code directly to it. The function below opens a window with the picture you name when you call the function it in. When this in turn is clicked Microsofts site comes up. You can adapt this method to put what you like in the popup window.


function poptest(picname)
{
var new_page = window.open(&quot;&quot;,&quot;&quot;,&quot;height=400,width=300,left=100,top=100,scrollbars=1,resizable=1&quot;);
new_page.opener = self;
new_page.document.writeln ('<HTML>');
new_page.document.writeln ('<HEAD>');
new_page.document.writeln ('<TITLE>Test1</TITLE>');

new_page.document.writeln ('</HEAD>');
new_page.document.writeln ('<BODY>');
new_page.document.writeln ('<A HREF=&quot; SRC=&quot;'+picname+'&quot; ALT=&quot;New Page&quot;></A>');
new_page.document.writeln ('</BODY>');
new_page.document.writeln ('</HTML>');
}

Obviously you can set your own dimensions for the popup or even add them as variables etc. and there's no reason you have to use HREF for the link, you could use another popup function, just be careful you get the speech marks right!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top