473,666 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onClick disable onMouseOut and make swap image default image

3 New Member
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="JavaS cript" 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 6307
acoder
16,027 Recognized Expert Moderator MVP
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.getEle mentsByTagName( "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
4434
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 on the image (it is a link to the content page) it changes to a third image AND STAYS THERE. ie: so the iamge won't change back to the omouseoff image. Does this make sense? Also, how do I "preload" the images before they are even needed? eg:...
3
13452
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. -----------------This is my code: <a href="nextpage.html" onMouseOver="document.green.src='red.gif'" onMouseOut="document.green.src='green.gif'">
2
9158
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 in the status bar 'Symantec Corporation' whenever anyone mouses over (onMouseOver) my image or link OR when one clicks while holding the left mouse down (onClick) on the same image or link. Upon releasing the mouse (onMouseOut), the
2
4078
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 event. Any ideas? - TIA
12
12269
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 page: <HTML> <HEAD> <style type="text/css">
2
2260
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 getting any problem . when ever mouse was changed paricular row that time color is lossed "When ever click the particular Row That time i want to show that color & that time dont loss that color( when ever onMouseover changed)" Here it's not...
2
1959
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="" id="arrow" src="arro-u.gif"</a>
6
4888
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: <html> <head> <!-- This file retrieved from the JS-Examples archives http://www.js-examples.com 1000s of free ready to use scripts, tutorials, forums.
11
4059
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'" onMouseOut="this.style.background='#00ff00'" onClick="window.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>'; parent.playClip(<?php echo $timeline->eventID?>, <?php echo...
0
8866
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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
8550
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
8639
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...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
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
2769
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
1772
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.