AllExperts > DHTML 
Search      
DHTML
Volunteer
Answers to thousands of questions
 Home · More DHTML Questions · Answer Library  · Encyclopedia ·
More DHTML Answers
Question Library

Ask a question about DHTML
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Jim Stiles
Expertise
I am a Certified Internet Web Designer with eighteen years experience in creating, developing and maintaining both personal and corporate web sites. I have an extensive working knowledge of HTML, DHTML, CSS and JavaScript. While I specialize in CSS, DHTML and JavaScript functions, my main topic is assisting persons and businesses with the overall development and outlay of their web sites. I also have 20 years of experience in Law Enforcement and Corrections. I have an extensive knowledge of all Microsoft Office applications, Windows OS 95 through XP, as well as Microsoft Exchange server 5.5 and Outlook Web Access. I am also certified in Video Teleconferencing, Network Systems Administration and Cisco CCND.

Experience
I have many various certifications from Microsoft and Cisco as well as individual course studies in web site development and advanced database development. I have developed and currently maintain several corporate web sites.
 
   

You are here:  Experts > Computing/Technology > HTML/XML > DHTML > Javascript question for Jim

DHTML - Javascript question for Jim


Expert: Jim Stiles - 6/21/2009

Question
Hi Jim:
I was wondering if you could help me. Firstly, thank you so much for all the information you provide at allexperts.com.
It has come in amazingly handy and has helped so much.

My question is a javascript coding question that I am absolutely desperate for an answer for.

I have a two images, image1.gif and image2.gif. When you roll over image1.gif it becomes newimage1.gif and image2.gif becomes newimage2.gif. So you roll over one and both change. No problem there. The only other thing I want to do is to get one of the new images - newimage2.gif - to be an image map.

The code I have now is:

<head>
<SCRIPT language="JavaScript">
<!--

   if (document.images) {
       pic1on = new Image(226, 93);
       pic1on.src = "images/newimage1.gif";
       pic2on = new Image(684, 296);
       pic2on.src = "images/newimage2.gif";
   }

   function lightup(imgName, imgName2) {
       if (document.images) {
           imgOn = eval(imgName + "on.src");
           document[imgName].src = imgOn;
           imgOn2 = eval(imgName2 + "on.src");
           document[imgName2].src = imgOn2;
       }
   }

   
//-->
</SCRIPT>
</head>
<body>
<A HREF="" onMouseover="lightup('pic1','pic2')"><IMG SRC="images/image1.gif" name="pic1" width="226" height="93" border="0"></A>
<br>
<img src="images/image2.gif" name="pic2" width="684" height="296" border="0">
</BODY>


Do you know what I would have to add to the code to make this happen?

If you have any idea and would be able to provide me with the information it would be GREATLY, GREATLY appreciated. Again, I am desperate.

Thank you for listening and thank you again for all the good work you do.

Sincerely,

Ari Strauch

Answer
I would probably place your image map inside a div. Then, show/hide the div using javascript. I have included two links showing examples for showing and hiding div containers.

http://jdstiles.com/java/hidetext.html
http://jdstiles.com/java/showhidelayers.html

Jim.


Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.