473,765 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnMouseOver and image maps working across multiple images

31 New Member
Hi all.

So: I've put together a page, in which I want several clickable image maps. I've put those together already. The problem with image maps is that they're not very intuitive, so users don't really expect the image to be clickable and accordingly won't even try to. The solution is to have the image highlight whenever the mouse travels over the mapped-out area; I understand that this is quite easy. Some Googling has provided a few solutions.

However, my problem is this: because of the way the page was designed, some of the images themselves are split into separate jpegs; they were sliced up by the designer in Photoshop. What I need your help with is ascertaining whether it's possible to have one mouseover highlight two jpegs. To illustrate, one of the images is of a pig, foal, lamb and chick, with each one image mapped already. To get the required effect I understand that I can create four new images: one with each animal highlighted. Then I can get the image map to show the highlighted version with a tiny bit of scripting. But the pig's ear is cut off, and sits in a different jpeg. Could a mouseover of the 'pig map' in the large jpeg also prompt the ear - a different jpeg entirely - to change as well?

I'm not explaining this very well, I have to admit, but in principle it seems simple. If you need any further explanation I'll be sure to give it another go.

Thanks for reading regardless. If you got this far.
Oct 29 '09 #1
13 5358
gits
5,390 Recognized Expert Moderator Expert
it is possible ... of course ... could you please post en example of the code you already have ... so that we have something to work with?

kind regards
Oct 29 '09 #2
Dormilich
8,658 Recognized Expert Moderator Expert
@seegoon
I’d try to change the mouse pointer shape (hand), so that is represents a link.
Oct 29 '09 #3
seegoon
31 New Member
@Dormilich
It seems to do that anyway. But I think the problem still remains - it's not obvious enough in my eyes.
Oct 29 '09 #4
seegoon
31 New Member
Here's a really stripped-down version of what I have at the moment, which should give a good impression. It works, but only on the one jpeg instead of across two.

Here's the Javascript in the header:

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2.  
  3. Image1 = new Image(232,275)
  4. Image1.src = "images/hostage-cover.jpg"
  5.  
  6. Image2 = new Image(232,275)
  7. Image2.src = "images/hostage-cover-highlighted.jpg"
  8.  
  9. function highlight() {
  10. document.hostage.src = Image2.src; return true;
  11. }
  12.  
  13. function original() {
  14. document.hostage.src = Image1.src; return true;
  15. }
  16.  
  17. </script>
  18.  
Here's the code for the image:
Expand|Select|Wrap|Line Numbers
  1. <img 
  2. name="hostage" 
  3. src="images/hostage-cover.jpg" 
  4. width="232" 
  5. height="275" 
  6. alt="Hostage cover" 
  7. usemap="#hostage"/>
  8.  
And here's the image map code:
Expand|Select|Wrap|Line Numbers
  1. <map name="hostage" id="hostage">
  2.  
  3. <area    
  4. shape="poly"
  5.     coords="2,34,26,273,255,254,201,14"
  6.     href="http://books.mileskelly.net/menu1_sub1_detail.asp?ID=657"
  7.     title="Click here to find out more about Hostage"
  8.     onMouseOver="highlight()"
  9.     onMouseOut="original()"/>
  10.  
  11. </map>
  12.  
In case you're worried, Hostage is a novel! If there is any wasted code here, then please let me know and I'll glady destroy it.

Basically, what I want is for that mouseover to highlight two images instead of just one.

Thanks!
Oct 29 '09 #5
Dormilich
8,658 Recognized Expert Moderator Expert
@seegoon
then you need to treat two images in the highlight() code.
Oct 29 '09 #6
seegoon
31 New Member
@Dormilich
Sorry, I don't understand. Do you mean add another image to the highlight() in the script in the header? Thanks.
Oct 29 '09 #7
Dormilich
8,658 Recognized Expert Moderator Expert
@seegoon
yupp, that’s what I’m talking about.
Oct 29 '09 #8
seegoon
31 New Member
@Dormilich
I've tried but I'm not getting it right. How should the code look? Thanks.
Oct 29 '09 #9
Dormilich
8,658 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. function highlight()
  2. {
  3.     img1.src = "picture1.jpeg";
  4.     img2.src = "picture2.jpeg";
  5. }
Oct 29 '09 #10

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

Similar topics

4
17112
by: Tim | last post by:
Hope someone in the big wide world can help... What I want to do is have an image slideshow which automatically scrolls through a series of images very fast, then pauses when you move your mouse over the image. The images will flick through (at a rate of about 5 per second) then pause when the user onMouseOver's. Any help would be gratefully received. :o)
12
12288
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">
3
3947
by: drjackk | last post by:
Hello, I'm trying to change the onmouseover event dynamically. This sets-up the initial onmouseover event: <a href="home.html"> <img border="0" id="img22" src="images/home1.jpg" height="15" width="85" alt="Home" onmouseover="FP_swapImg(1,0,/*id*/'img22',/*url*/'images/home2.jpg')"</a>
4
2135
by: Rob R. Ainscough | last post by:
I'm using .NET v1.1 with ASPX web page. I'm trying to have a RollOver hyperlink that will change images on an image control and update the text in a Label control. I've got the image swapping working, however I don't know how to get my Label control text to change with the onMouseOver event HTML... </asp:hyperlink><asp:hyperlink id="lnkImageS" style="Z-INDEX: 113; LEFT:
1
18853
by: den2005 | last post by:
Hi everybody, I am confused and still looking why this codes is not working. Can anyone notice or know why this code is not working? Thanks in advance. Code working: <form id="form1" runat="server"> <div> &nbsp;</div> <div>
2
2984
by: sachaburnett | last post by:
Hi everyone! I'm new to Javascript and am finding so much useful information on this group, so thanks to you all! I have a question about preloading images for onmouseover/out effects and found so many different ways to do it on the Net but am not sure about something. Right now I have the following code inside my <head> tag:
9
1865
by: peashoe | last post by:
I need to create a javascript that not only changes a picture, but also the link: here is an example of what I need www.myweddingfavors.com/ I'm working on this website and have it half done: www.mygiftbasketideas.com - I also what the table to change color on mouseover - this is the code I am using so far: in the script.js if (document.images) { image2= new Image(100,100);
7
3647
by: petethebloke | last post by:
Can anyone help? I have a client who has made a "dynamic interactive map" of our city using Dreamweaver. Each map file has hotspots that pop-up a div with a little image when the mouse goes over them. They also link to another file. I've converting the application to a PHP-AJAX system at http://www.ilex-urc-maps.com/testing.html but I can't get the dynamically altered hotspots to work. Any ideas? Please don't tell me that the client...
0
9568
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
9399
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
10007
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...
0
9833
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
8831
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...
1
7378
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
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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
3
2806
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.