Solved

MouseOver to change image and text?

Posted on 2009-04-02
2
211 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
2 Comments
 
LVL 9

Expert Comment

by:unassassinable
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now