• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

MouseOver to change image and text?

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
clientos
Asked:
clientos
1 Solution
 
unassassinableCommented:
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
 
clientosAuthor Commented:
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 expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now