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

passing data to pop up windows 1

Status
Not open for further replies.

clownkevin

Technical User
Dec 6, 2000
11
GB
I wonder if anyone can help?
I am trying to open a popup window and pass an image to it dynamically, setting it as the background to the page (to avoid the border)
I need to reuse the window for each subsequent picture, and pass the focus back to the popup so it will be visible when a new image is selected.

This is my code so far...

In the <head> section...

<SCRIPT LANGUAGE=&quot;Javascript&quot;>
<!--Hide
browserName=navigator.appName;
browserVer=parseInt(navigator.appVersion);
ns3up=(browserName==&quot;Netscape&quot;&&browserVer >=3);
ie4up=(browserName.indexOf(&quot;Microsoft&quot;)>=0&&browserVer>=4);
var imgOn
function doPic(imgName){if (ns3up||ie4up){imgOn=(&quot;&quot;+imgName);
myWindow=window.open(&quot;large.htm?imgOn&quot;, &quot;myWindow&quot;, &quot;width=640,height=480,status=no,scrollbars=no,resizable=no,toolbar=no,menubar=no,left=0,top=0&quot;);
myWindow.focus();
}}
//-->
</script>


In the body...

<td><a href=&quot;javascript:doPic('images/slideshow/pic1a.jpg');&quot;><img src=&quot;images/slideshow/p1a.jpg&quot; border=0 alt=&quot;Approaching the Arch&quot;></a></td>

<td><a href=&quot;javascript:doPic('images/slideshow/pic1.jpg');&quot;><img src=&quot;images/slideshow/p1.jpg&quot; border=0 alt=&quot;Nearer the Arch&quot;></a></td>

etc.

code for the pop up window...

<HTML>
<HEAD>
<TITLE>&nbsp</TITLE>
</HEAD>
<SCRIPT>
var backg = document.location.search;
backg = backg.substring(1, backg.length);
document.write(&quot;<BODY BACKGROUND=&quot; + backg + &quot;>&quot;);

</SCRIPT>
</BODY>
</HTML>

Where am I going wrong??? The window pops up but no image, help me please, head bursting...

Clown Kevin
 
backg = backg.substring(1, backg.length);
alert(backg) -> is it the value you expected ?

also, you should read the faq in this forum about &quot;passing parameters&quot;
 
the alert gives me - imgOn - so something is being passed, but imgOn is supposed to be a variable that picks up the url of the image from the body of the document in the first bit of the function, i.e. &quot;images/slideshow/picx.jpg&quot;.

Still therefore puzzled, also confused at not being able to find anything about passing parameters in the faqs. Must have head on backwards today...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top