473,665 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

website code to show large and full size image on click

17 New Member
So i have my images set up like this : http://cgi.ebay.com/Tippmann-98-paintBall-Marker-Gun-Paint-Ball_W0QQitemZ2 50274334261QQih Z015QQcategoryZ 47248QQssPageNa meZWDVWQQrdZ1QQ cmdZViewItem

Scroll down to the bottom and you see several images, One large one and then several smaller ones, when you click on the smaller ones it places a larger version of that picture in place of where the other larger picture was, well i use this method on my website but what i want to do is make it so that when you click on the smaller image and it comes up in the larger image spot, you can click on the larger image also to make it into an even bigger supersized picture, but i cant simply link the large picture because it needs to change every time for each smaller picture, so what i need it some type of code that changes the background URL of the bigger image every time you click on the smaller image, while still letting it function properly. So i need someway of being able to do this. Like everytime you click the smaller image, a large one appears in the place of the large image and also somehow makes it so that when you click the large image it also takes you to a super sized image, either by way of URL or some other form.

Any help is greatly appreciated. Sorry for the long post but it is kind of hard for me to explain.
Aug 3 '08 #1
13 29650
acoder
16,027 Recognized Expert Moderator MVP
The src property of the image will contain the URL to the full-size image. Use that to show the full-size image onclick, e.g.
Expand|Select|Wrap|Line Numbers
  1. <img ... src="whatever.png" onclick="location.href=this.src;">
or
Expand|Select|Wrap|Line Numbers
  1. <a href="original.png" onclick="this.href=document.getElementById('largeImg').src;"><img id="largeImg" src="whatever.png"></a>
or you could change the href when you change the large image onclick of the small image.
Aug 3 '08 #2
sevenz24
17 New Member
Thank you very much for your reply, tho i am not sure how to insert your code into mine since i already have an onclick event in my code, this is the code i'm using currently for my picture setup:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <tr>           
  3. <td height="399"><img src="http://dadetrader.com/Pics/PICT1591.JPG" name="productimages_" width="486" height="365" border="0" align="top"/></a></td>         
  4. </tr>         
  5. <tr>           
  6.  
  7. <td height="99" align="center" valign="top">
  8.  
  9. <a href=#productimages onclick="productimages_.src='http://dadetrader.com/pics/PICT1591.JPG'" onfocus="blur()"><img src="http://dadetrader.com/thumbnails/PICT1591.JPG" width="156" height="117" border="0"/></a>
  10.  
  11. <a href=#productimages onclick="productimages_.src='http://dadetrader.com/pics/PICT1592.JPG'" onfocus="blur()"><img src="http://dadetrader.com/thumbnails/PICT1592.JPG" width="156" height="117" border="0"/></a>
  12.  
  13. <a href=#productimages onclick="productimages_.src='http://dadetrader.com/pics/PICT1593.JPG'" onfocus="blur()"><img src="http://dadetrader.com/thumbnails/PICT1593.JPG" width="156" height="117" border="0"/</a><br></td>         
  14.  
  15. </tr>

(i spaced out the code so you can see it better)

Pretty much when i click on the 1591, 1592, 1593 small image links it then also shows up in the large image location, but what i want is after i do click on the small image link, and it does its magic, i also want the big image to now be clickable to show a supersized image, and obviously this has to change for each small image link i click. I was thinking the only way of doing this is by using some complicated javascript function or something to be able to use 2 onclick functions in 1 link/image or something like that, dont know.
Aug 3 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
Try replacing the large image with
Expand|Select|Wrap|Line Numbers
  1. <a href="http://dadetrader.com/Pics/PICT1591.JPG" onclick="this.href=document.getElementById('largeImg').src;"><img id="largeImg" src="http://dadetrader.com/Pics/PICT1591.JPG" ...></a>
Aug 3 '08 #4
sevenz24
17 New Member
ok so lets say my supersized image URL would be http://www.dadetrader.com/picsbg/pict1588.jpg, and ETC, how would i use that with this code?
also ultimately i am going to incorporate a popup window with the supersized image, so when you click the large image you get a popup with the supersized image.
Aug 4 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
The code would be the same or similar. The onclick changes the link href to the current source of the image (which will have been changed from clicking the small images).

To open a popup window, use window.open().
Aug 4 '08 #6
sevenz24
17 New Member
Hmm, this doesn't make much sense and is very confusing, nor does it solve the problem I'm asking at all, very unhelpful, oh well thanks anyway I will try another forum.
Aug 5 '08 #7
acoder
16,027 Recognized Expert Moderator MVP
I can't see why you think that. If you follow what I've suggested, it should solve your problem. Have you tried incorporating the changes into your code? You've not shown me what you've attempted with the code given.

If there's a part of the code that you don't understand, I could explain it to you if you want. If JavaScript is the problem, perhaps you should be consulting a tutorial first. Sure, you may get someone doing all the work for you on another forum, but that wouldn't help much by way of learning. Hope that helps.
Aug 5 '08 #8
sevenz24
17 New Member
I can't see why you think that. If you follow what I've suggested, it should solve your problem. Have you tried incorporating the changes into your code? You've not shown me what you've attempted with the code given.

If there's a part of the code that you don't understand, I could explain it to you if you want. If JavaScript is the problem, perhaps you should be consulting a tutorial first. Sure, you may get someone doing all the work for you on another forum, but that wouldn't help much by way of learning. Hope that helps.
Yea I tried putting your code in, in many different ways, but it just doesnt work out the way I want it to.

I need the big picture to link me to http://www.dadetrader.com/picsbg/pict124.jpg (for example), changing that link everytime when clicking on the smaller picture, but it only links to the same picture opening up another page, which is what the smaller pictures are linked to.... but i cant change the smaller links because then it wouldnt change the large picture at all in the first place.

Also, Its much easier to learn when I do have the entire code, It lets me understand how it works and how I could change it and mend it next time to use it in another way for something different, instead of having no idea what your telling me or no idea of seeing how what your telling me could work... which right now im sure so far what you have showed me wont work the way I need it to, and the popup part is not a problem forget about that, if we could get it to actually link to the supersized image in the first place then that would be nice (which is the whole point).
Aug 5 '08 #9
acoder
16,027 Recognized Expert Moderator MVP
OK, let's try again. In your code in post #3, replace line 2 with:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <td height="399"><a href="http://dadetrader.com/Pics/PICT1591.JPG" onclick="this.href=document.getElementById('largeImg').src;"><img id="largeImg" src="http://dadetrader.com/Pics/PICT1591.JPG" name="productimages_" width="486" height="365" border="0" align="top"/></a></td>
When the large image src property is changed, then the link href hasn't changed yet (though you could add that to each small image onclick, but let's try to keep things simple), so what the link onclick does is change the link href to point to whatever the current src of the large image is. Try it out and see what happens.
Aug 5 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5529
by: André Næss | last post by:
Photoshop has a function called optimize to file size which tries to fit an image to some given file size. Because I need to make sure no images on a site I'm working on are larger than X KB I need something similar so that users don't have to worry so much about image file size. Does anyone know of a way to do this, preferably using ImageMagick or GD? Doing several calls to ImageMagick with different optimize settings is a not a good...
9
4086
by: Deepa | last post by:
Hi All, I'm facing problem displaying image of size 5000X5000 .My window size is smaller than image size so i'm not able to see the complete image.i can use scroll bars to view the image but i need to rotate the image and the see the result everytime. For this my boss has given me suggestion to display only 20% of the image on window ,and rotation has to be applied to original copy.
1
1097
by: Paul Aspinall | last post by:
Hi How can I implement an easy, resusable "Click to see full size screenshot" functionality on my images? I have 2 copies of each image... one which is 'sml', and another which is the full size version How can I redirect on a mouse click to show the full size version?? I am looking for a reusable piece of code (ie. small code, or a control)
2
2869
by: Ahmd | last post by:
Pls look at this code, i want to call this function from an image click event. CPage=Cint(Request.Form("CurrentPage")) 'get CPage value from form's CurrentPage field Select Case Request.Form("Submit") Case "Previous" 'if prev button pressed CPage = Cint(CPage) - 1 'decrease current page Case "Next" 'if next button pressed
1
1803
by: liesther2003 | last post by:
Hi i want to show mutli layer by each click, and when i click next layer the first layer should be still display, until maybe 3rd or 4th or 5th layer all are displayed, and at the end when i click somewhere (maybe image) then close all layer. my code are here <script type="text/javascript"> var currlayerId = null; function toglayer(id) { if(currlayerId) setDisplay(currlayerId, "none");
2
2052
kamill
by: kamill | last post by:
Dear All, I am uploading a image file and after resize the image i am saving it. My script is working fine with small size images but when i am trying to upload big size image, i am getting below error. Error 500 - Internal server error An internal server error has occured! Please try again later. My ini settings are as below
1
3842
by: cleary1981 | last post by:
Hi, I want to create a page for monitoring levels. I need a really large font size. 200 - 300px if possible. I have tried all the css methods using %, px, and xx-large, but none make a difference. Heres my code <html> <head> <style type="text/css"> #ch1{ position:absolute;
18
4773
by: amritpalpathak | last post by:
I have made the html+javascript code.According to which when the page loaded the image size gets reduced to 50,50 and onclicking on it ,size increases to 500,500,but i done it with the one copy of image But i want the click at thumnail of photos and display the full resolution of thumnail. <html> <body> <body onload="changeIt();"> <head>
0
8438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.