473,545 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying bigger pictures when click on the thumbnail (onclick event)

7 New Member
Please can anyone help with a javascript code to display bigger pictures me.jpg, me2.jpg.... on the same page by clicking on their thumnails on the same page.

I have done what i believe is the right thing but still doesnt work. Below is my code:


Pictures are in the same folder as the Html file to keep things simple
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3.  
  4. <!-- Set up a Javascript Script to handle the mouseOver events: AJAX effect -->
  5.  
  6.  <SCRIPT language="JavaScript">
  7.          var XMLHttpRequestObject = false;
  8.  
  9.          if (window.XMLHttpRequest)
  10.              {
  11.              XMLHttpRequestObject = new XMLHttpRequest();
  12.              }
  13.          else if (window.ActiveXObject) {
  14.              XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
  15.              }
  16.  
  17.  
  18.  
  19.          function getData(dataSource, divID)
  20.              {
  21.              if(XMLHttpRequestObject)
  22.                  {
  23.                  var obj = document.getElementById(divID);
  24.                  XMLHttpRequestObject.open("GET", dataSource);
  25.  
  26.                  XMLHttpRequestObject.onreadystatechange = function()
  27.                      {
  28.                      if (XMLHttpRequestObject.readyState == 4 &&
  29.                      XMLHttpRequestObject.status == 200) {
  30.                      obj.innerHTML = XMLHttpRequestObject.responseText;
  31.                      }
  32.                  }
  33.  
  34.                  XMLHttpRequestObject.send(null);
  35.                  }
  36.              }
  37.   </script>
  38.  
  39.  
  40. <TITLE>
  41. Picture Gallery
  42. </TITLE>
  43.  
  44. </HEAD>
  45.  
  46. <BODY BACKGROUND="pic2.jpg">
  47.  
  48. <TABLE ALIGN="left" WIDTH="100%">
  49. <TR ALIGN="left">
  50.  
  51. <TD width= "50%" colspan = 2>
  52. <table border =1 bordercolor= "orange">
  53.     <tr ><TD><img src= "me.jpg" width="244" height="163" onmouseover="getData('me.jpg', 'targetDiv')"></td>
  54.     <td><img src= "me2.jpg" width=244 height=163 onmouseover="getData('me2.jpg', 'targetDiv')"></td></tr>
  55.     <tr><TD><img src= "me3.jpg" width=244 height=163></TD></tr>
  56.     <tr><td><img src= "me4.jpg" width=244 height=163></td></tr>
  57.     <tr><td><img src= "me&bisi.jpg"  width=244 height=163></td></tr>
  58. </table>
  59. </TD>
  60.  
  61.  
  62. <TD width= "50%" bgcolor= "">
  63. <!-- Area for the display of the text generated by the mouseOver event -->
  64. <center>
  65. <div id="targetDiv"></div>
  66. </TD>
  67.  
  68. </TR>
  69. </TABLE>
  70.  
  71.  
  72. </BODY>
  73. </HTML>
Jul 30 '07 #1
1 2004
pbmods
5,821 Recognized Expert Expert
Heya, greatjuli. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

It looks like you may be using a sledge hammer when a ball-peen will do the trick.

Try this instead:
Expand|Select|Wrap|Line Numbers
  1. function getData(dataSource, divID)
  2. {
  3.     document.getElementById(divID).src = dataSource;
  4. }
  5.  
Jul 30 '07 #2

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

Similar topics

7
2317
by: Vinay | last post by:
Hi All: I have a small application that stores images either in the database or as files (depending on the user preference). I'm in the process of providing a web interface to this application. 1. If the images are stored in the DB then, every an image is requested, it will need to be pulled out and a temp file created and then displayed?...
3
4896
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls are Web Control & not HTML control. One of these buttons whose title is Delete is added on the aspx page in design view & also I double clicked on...
7
1179
by: Vinay | last post by:
Hi All: I have a small application that stores images either in the database or as files (depending on the user preference). I'm in the process of providing a web interface to this application. 1. If the images are stored in the DB then, every an image is requested, it will need to be pulled out and a temp file created and then displayed?...
7
338
by: Vinay | last post by:
Hi All: I have a small application that stores images either in the database or as files (depending on the user preference). I'm in the process of providing a web interface to this application. 1. If the images are stored in the DB then, every an image is requested, it will need to be pulled out and a temp file created and then displayed?...
0
7490
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...
0
7425
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...
0
7682
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7449
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...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
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...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1911
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
0
734
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...

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.