Reply
onClick browser window attributes change
Old 10-22-2007, 01:42 PM onClick browser window attributes change
Super Talker

Posts: 129
Hi, got a question, don't know if it's possible to solve though
I'm using thumbnail images on a webpage and have set it (through DW) so that when the onClick event occurs, a new page opens displaying a larger version of the image. What I have been doing is creating a page for each large image, which seems a bit longwinded to me. What I would like to do is use the onClick event to call a page, but then change the img src dependant upon which thumbnail is clicked. This is the code so far that exists behind the "Bob" thumbnail:
Code:
onClick="MM_openBrWindow('Bob.htm','Bob','width=800,height=533')"
How do I incorporate img src into this so that behind each thumbnail is a differently specified img src i.e Images/Park.jpg, or Images/Pram.jpg and "Bob.htm" is replaced say by "Large.htm", a one size fits all page?
Rambling? Sorry!
Hope someone can help, thanks, Lol
__________________
www.17minutes.co.uk - Street Photography
Lol999 is offline
Reply With Quote
View Public Profile Visit Lol999's homepage!
 
When You Register, These Ads Go Away!
     
Old 10-22-2007, 02:14 PM Re: onClick browser window attributes change
Skilled Talker

Posts: 97
Name: Ganesh
Lol,

If I understand you requirement is one page for all images and it should show the clicked thumbnail's bigger version.

It lot easy in a CGI file however if you want to do it on javascript:

In the large.htm

you should have


<img id="largeimg">


On the BODY onload have javascript function which can get the image name and use the getElementById() function and replace the src value of the image clicked.

Use the below function to read the query string via javascript
Code:
 
function querystring(name)   // returns a named value from the querystring
{
   var tmp = ( location.search.substring(1) );
   var i   = tmp.toUpperCase().indexOf(name.toUpperCase()+"=");
 
   if ( i >= 0 )
   {
      tmp = tmp.substring( name.length+i+1 );
      i = tmp.indexOf("&");
      return unescape( tmp = tmp.substring( 0, (i>=0) ? i : tmp.length ));
   }
 
   return("");
}
 
 
var val = querystring("param");'
alert(val);
Ideally you would use it like

Code:
Onclick event on thumbnail of Pram.jpg:
 
onClick="MM_openBrWindow('large.htm?pn=Images/Pram.jpg','Bob','width=800,height=533')"
 
Onclick event on thumbnail of Park.jpg:
 
onClick="MM_openBrWindow('large.htm?pn=Images/Park.jpg','Bob','width=800,height=533')"

Is this what you looking for?
__________________
Gather. Search. Compare. Save on Hotel and Flight Prices @ www.vtrip.info
sri_gan is offline
Reply With Quote
View Public Profile
 
Old 10-22-2007, 05:08 PM Re: onClick browser window attributes change
Super Talker

Posts: 129
Hi ganesh, it looks the business but I couldn't get it to work. However, what I did was this, adapted from my current site:

Code:
"Large.asp?photo=Images/People/Large/Bob.jpg"target=_blank"
Placed this code in front of the onMouseOver behaviour that also exists for the thumbnail.

I then created n asp page called Large.asp and place this code in it to receive the parameter "photo"
[code][<td><div align="center"><img src="<%=Request.Querystring("photo")%>"></div></td>/CODE]

and it works!

Thanks for your help anyway, Lol
__________________
www.17minutes.co.uk - Street Photography
Lol999 is offline
Reply With Quote
View Public Profile Visit Lol999's homepage!
 
Reply     « Reply to onClick browser window attributes change
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13373 seconds with 13 queries