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

Popup window titlebar name and close button

Status
Not open for further replies.
Aug 6, 2004
271
GB
HI,

not sure if this is possible but anyway.

I have a popup window of an image that appears when a thumbnail of the image is clicked within the main website. When this window opens, in the titlebar it shows the url of the image opened.

What I want to is have the title on the title bar changed to the name of the website and include a "Close Window" button at the bottom of the window.

I have used the Behaviours panel and "Open Browser Window" OnCLick to create the popup.

Below is the code from one of the thumbnails and how it creates the popup:

<a href="javascript: void(0)" onClick="MM_openBrWindow('images/CommercialOne.jpg','','status=yes,scrollbars=yes,resizable=yes,width=754,height=533')"><img src="images/Commercial%20One.jpg" alt="Alt text of Image" width="129" height="109" border="0"></a>

Can anyone help??
 
you could have one set page that displays all photos and adjust the title as you wish.

instead of having the a href being the image location you could put like

Code:
'mypopuppage.asp?x=commercialone.jpg'

then on the mypopuppage.asp - have it do an image src of whatever the value of x is.
Code:
<img src="images/<%=request.querystring("x")%>">

You could even pass an additional value for a dynamic title if you have any other values to pass such as picture name.


for closing you just put.

Code:
<a href="javascript:self.close()">close this window</a>

------- not question related - alternative suggestion -----

Now for a little treat. Say you have images that are different in size.

Simply try something like this

on your page that will launch the popup.

somewhere in the head - or at least above the pictures.

Code:
	<script language="Javascript"> 
   function PopupPic(sPicURL) { 
     window.open( "popup.html?"+sPicURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200"); 
   } 
   </script>

the link

Code:
<a href="javascript:PopupPic('images/commercialone.jpg')"><img src="images/commercialone.jpg"></a>

page name - popup.html

-head code
Code:
<script language='javascript'> 
   var arrTemp=self.location.href.split("?"); 
   var picUrl = (arrTemp.length>0)?arrTemp[1]:""; 
   var NS = (navigator.appName=="Netscape")?true:false; 

     function FitPic() { 
       iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
       iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
       iWidth = document.images[0].width - iWidth; 
       iHeight = document.images[0].height - iHeight; 
       window.resizeBy(iWidth, iHeight); 
       self.focus(); 
     }; 
 </script>

and body code.

Code:
 <script language='javascript'> 
 document.write( "<img src='" + picUrl + "' border=0>" ); 
 </script>

Just include your closing script if you wish - I don't on mine.

"Ever stop to think, and forget to start again?"

Stuart
A+, Net+
 
The only thing is is that the popup page - I dont create it. It is an image and so i dont have control over the code on the page created. The way(s) you are suggesting would imply that I create pages with the images in them?

I am no classy web developer (yet, ha ha) so forgive me if my quest seems strange
 
Create a html page that contains the image, then do what schase says.

Dodge20
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top