?
Solved

MouseOver to change image and text?

Posted on 2009-04-02
2
Medium Priority
?
225 Views
Last Modified: 2012-05-06
Hi!!

I currently have my website here: www.abdultaiyeb.com

As you can see, I am using a barcode as a navigational interface such that when a 'bar' of the barcode is 'mouseovered', it changes the image and also provides a link.

I was deciding on changing things around a little though. I was thinking of implementing a text box under the barcode (empty at first) that would provide a brief explanation of the link when there is a mouseover. The text box would change as the user mouseovers another bar of the barcode.

The only solutions I've found so far have either an image mouseover, or a text mouseover. Is there a way to combine the two? Also, is there a way to keep the width of the text box constant, while the height changes according to the amount of text present?

You can view the current source of my website by right clicking and viewing source when visiting my website. I have also attached the code though.

I'm pretty new to Javascript, so please bear with me :)

Thanks!!
<script language="JavaScript">
if (document.images) {
 
 img1_on =new Image(); img1_on.src ="http://www.abdultaiyeb.com/barcode/1.png"; 
 img1_off=new Image(); img1_off.src="http://www.abdultaiyeb.com/barcode/1.png"; 
 
 img2_on =new Image(); img2_on.src ="http://www.abdultaiyeb.com/barcode/2.png"; 
 img2_off=new Image(); img2_off.src="http://www.abdultaiyeb.com/barcode/2.png"; 
 
 img3_on =new Image(); img3_on.src ="http://www.abdultaiyeb.com/barcode/3.png"; 
 img3_off=new Image(); img3_off.src="http://www.abdultaiyeb.com/barcode/3.png"; 
 
 img4_on =new Image(); img4_on.src ="http://www.abdultaiyeb.com/barcode/fakemailer.png"; 
 img4_off=new Image(); img4_off.src="http://www.abdultaiyeb.com/barcode/3.png"; 
 
 img5_on =new Image(); img5_on.src ="http://www.abdultaiyeb.com/barcode/pagerankchecker.png"; 
 img5_off=new Image(); img5_off.src="http://www.abdultaiyeb.com/barcode/3.png"; 
 
 img6_on =new Image(); img6_on.src ="http://www.abdultaiyeb.com/barcode/proxy.png"; 
 img6_off=new Image(); img6_off.src="http://www.abdultaiyeb.com/barcode/3.png"; 
 
 img7_on =new Image(); img7_on.src ="http://www.abdultaiyeb.com/barcode/urlshortener.png"; 
 img7_off=new Image(); img7_off.src="http://www.abdultaiyeb.com/barcode/3.png";
 
 img8_on =new Image(); img8_on.src ="http://www.abdultaiyeb.com/barcode/youtubevideodownloader.png"; 
 img8_off=new Image(); img8_off.src="http://www.abdultaiyeb.com/barcode/3.png";
 
 img9_on =new Image(); img9_on.src ="http://www.abdultaiyeb.com/barcode/blog.png"; 
 img9_off=new Image(); img9_off.src="http://www.abdultaiyeb.com/barcode/4.png";
 
 img10_on =new Image(); img10_on.src ="http://www.abdultaiyeb.com/barcode/gadgets.png"; 
 img10_off=new Image(); img10_off.src="http://www.abdultaiyeb.com/barcode/4.png";
 
}
 
function movr(k) {
 if (document.images) 
  eval('document.img'+k+'.src=img'+k+'_on.src');
}
 
function mout(k) {
 if (document.images) 
  eval('document.img'+k+'.src=img'+k+'_off.src');
}
 
function handleOver() {
 if (document.images) 
  document.imgName.src=img_on.src;
}
 
function handleOut() {
 if (document.images) 
  document.imgName.src=img_off.src;
}
 
</script>
 
 
<style type="text/css">
.style1 {
	text-align: center;
}
</style>
 
</head>
 
<body>
 
<p class="style1">&nbsp;</p>
<p class="style1">&nbsp;</p>
<p class="style1">&nbsp;</p>
<p class="style1">&nbsp;</p>
<p class="style1">&nbsp;</p>
<p class="style1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/3.png" width="17" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />&nbsp;&nbsp;
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<a href="http://www.abdultaiyeb.com/blog" onMouseOver="movr(9);return true;" onMouseOut="mout(9);return true;"><img name=img9 border=0 src="http://www.abdultaiyeb.com/barcode/4.png"></a>
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />&nbsp;
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />&nbsp;
<a href="http://www.abdultaiyeb.com/fakemailer" onMouseOver="movr(4);return true;" onMouseOut="mout(4);return true;"><img name=img4 border=0 src="http://www.abdultaiyeb.com/barcode/3.png"></a>
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />&nbsp;&nbsp;
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/4.png" width="28" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/3.png" width="17" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/3.png" width="17" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />&nbsp;&nbsp;
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />&nbsp;
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/3.png" width="17" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/3.png" width="17" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/1.png" width="3" height="324" />
<img alt="" src="http://www.abdultaiyeb.com/barcode/2.png" width="7" height="324" /></p>

Open in new window

0
Comment
Question by:clientos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Expert Comment

by:unassassinable
ID: 24056721
Heres a site I just finished that has the effect you may be looking for"

http://www.equinoxits.com/packages.php   -   markup
http://www.equinoxits.com/style.css           -   CSS
*do a search for PACKAGES.PHP in the css.  it will take you to the appropriate section

if you click on the corporate, intermediate or basic headings you can see the effect.  Its 99% CSS, and one small line of JS.  The effect can be changed to onmouseover display this and that, rather than click.  
0
 

Accepted Solution

by:
clientos earned 0 total points
ID: 24066039
I actually realised I don't need to use Javascript anymore. So I'm planning to use Flash instead. That will also allow me to do other things as I have a better knowledge of Flash! Thanks for the help though.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question