473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

onClick disable onMouseOut and make swap image default image

On mouseover it goes to the correct map say TheMap1.jpg and then on mouseOut it defaults back to map, I need to do a onClick that sets the TheMap1.jpg mouseOver to the default TheMap.jpg so the TheMap1.jpg is now the default image not the TheMap.jpg. So after I click for information, and mouseOut of that area TheMap1.jpg will stay as all the MouseOuts Until I click another area of the map say TheMap10.jpg once clicked TheMap10.jpg will become the default image.

See code/ example of what I am doing http://www.wrighter.com/map

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
Expand|Select|Wrap|Line Numbers
  1.     if(document.images)
  2.     {
  3.       imagemap_TheMap = new Image();
  4.       imagemap_TheMap.src = '/wcss/images/TheMap.jpg';
  5.       imagemap_TheMap1 = new Image();
  6.       imagemap_TheMap1.src = '/wcss/images/TheMap1.jpg';
  7.       imagemap_TheMap2 = new Image();
  8.       imagemap_TheMap2.src = '/wcss/images/TheMap2.jpg';
  9.       imagemap_TheMap3 = new Image();
  10.       imagemap_TheMap3.src = '/wcss/images/TheMap3.jpg';;
  11.       imagemap_TheMap4 = new Image();
  12.       imagemap_TheMap4.src = '/wcss/images/TheMap4.jpg';
  13.       imagemap_TheMap5 = new Image();
  14.       imagemap_TheMap5.src = '/wcss/images/TheMap5.jpg';
  15.       imagemap_TheMap6 = new Image();
  16.       imagemap_TheMap6.src = '/wcss/images/TheMap6.jpg';
  17.       imagemap_TheMap7 = new Image();
  18.       imagemap_TheMap7.src = '/wcss/images/TheMap7.jpg';
  19.       imagemap_TheMap8 = new Image();
  20.       imagemap_TheMap8.src = '/wcss/images/TheMap8.jpg';
  21.       imagemap_TheMap9 = new Image();
  22.       imagemap_TheMap9.src = '/wcss/images/TheMap9.jpg';
  23.       imagemap_TheMap10 = new Image();
  24.       imagemap_TheMap10.src = '/wcss/images/TheMap10.jpg';
  25.       imagemap_TheMap11 = new Image();
  26.       imagemap_TheMap11.src = '/wcss/images/TheMap11.jpg';
  27.     }
  28.     function rollOver(iName,iState)
  29.     {
  30.       if(document.images)
  31.       {
  32.         document.images[iName].src = eval(iName + '_' + iState + '.src');
  33.       }
  34.     }
  35.  
// -->
</SCRIPT>
Oct 11 '06 #1
1 6282
acoder
16,027 Expert Mod 8TB
Just set the src of the image(s) onclick to the onmouseover image, e.g. onclick = "this.src = imageMap.src" or even call rollOver with the correct parameters. If all images need to be changed, use document.getElementsByTagName("img") to get all the images to loop over and set the src of each.
May 22 '08 #2

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

Similar topics

2
by: Rob Manger | last post by:
Hi All, I am hoping someone can help me. I am trying to setup my main page so that when the user moves the mouse over an image, it changes the source (got this working). When the user CLICKS...
3
by: John | last post by:
Imagine this: I have a gif-image with text, coloured green. When MouseOver occurs the gif will swap to another gif with red colourded text. On MouseOut the gif turns back to the green text. ...
2
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
2
by: WindAndWaves | last post by:
Hi Folk I have an image map (map of New Zealand with various areas defined using an image map). Now I am wondering if it is possible to link this "image map" to an onclick and onmouseover...
12
by: Epetruk | last post by:
Hi all, I want a page where the contents of a table cell are replaced with an image when the mouse moves over the cell, and the text is restored when the mouse moves out. Here's the html for the...
2
by: karunakar | last post by:
Hi All In datagrid OnMouseOver iam showing some color Onmouseout also working fine . Here my problem is when ever click the pariculat row in DataGrid iam showing red color that time i am not...
2
by: webdeveloper | last post by:
sorry about that, This is the event handling element: <div id="menu"> <ul> <li>.... <li><a href="javascript:expand_menu(document.getElementById('extend'))" id="extend">Text <img src=""...
6
by: Marko Mikkonen | last post by:
I'm trying to make code which does something when user clicks a row in a table. I tried a javascript code from JS-Examples.com. It works on Firefox, but not on Internet explorer 7. Here's the code:...
11
by: nma | last post by:
Hi How can I make the anchor link once I do onclick? <td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#00ff00" onMouseOver="this.style.background ='red'" ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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,...

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.