AllExperts > Experts 
Search      

Javascript

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Javascript Answers
Question Library

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

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Anthony Levensalor
Experience
I have been programming in Java and Javascript since 1998. I run a web development company that specializes in Ajax front ends with PHP/MySQL back ends. I am a Sun Certified Java 2 Developer, and have done nothing but web applications for the last two years in my business

Past/Present clients
Monster.com, Compuware Corporation, Flextronics International, Pragmatech Software, Open Travel Software, The Loss Mitigation Institute, Raw Story Media, Page One News Media.

 
   

You are here:  Experts > Computing/Technology > Focus on JavaScript > Javascript > Mouse Over A Text - Getting A Pic

Topic: Javascript



Expert: Anthony Levensalor
Date: 10/4/2007
Subject: Mouse Over A Text - Getting A Pic

Question
Dear Anthony  Levensalor

I've seen a site, that is http://www.zonegifs.com/gifs/ . The question is:
How could I make that javascript code where mousing over a word, we can get a picture example from the next.

Hope you understand.

Yours,

Ari

tarleno@yahoo.com  

Answer
You'd want to set up a display element, a div or span usually, and then an add an image tag to the element and control positioning as appropriate with style attributes.

<div id="imgDisplay" style="display:none;"><img id="image" src="" /></div>

<a href="somelink" onmouseover="getImg('somegif.gif');" onmouseout="clearImg();">Some link</a>

function getImg(imgName)
{
 document.getElementById('image').src = imgName;
 document.getElementById('img_display').style.visible="block";

} // getImg

function clearImg()
{      
 document.getElementById('img_display').style.display="none";
} // clearImg

That should accomplish what you're looking to do, setting the image on mouseover of another element.

All the best,
~A!

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.