Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-15-2005, 03:21 AM   PM User | #1
vlane95678
New to the CF scene

 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
vlane95678 is an unknown quantity at this point
NEED HELP ASAP w/ mouseout argument

Hello, I am using a js script with a mouseover w/ drop down menu from this web site.

Everything works find but the mouseout argument. When you mouseout, the image stays the same and it should change. Here's the JS code:

<a onmouseover="image1.src='http://www.qdobanv.com/LanitechArtwork/button_home_on.gif', dropdownmenu(this, event, 'anylinkmenu1');" onmouseout="image1.src='http://www.qdobanv.com/LanitechArtwork/button_home_off.gif';" target="_self" href="index.htm">
<img name="image1" src="LanitechArtwork/button_home_off.gif" border="0" width="91" height="39"></a>

And here's the drop down menu code (which I don't think matters anyhow):

<!--1st anchor link and menu -->
<div id="anylinkmenu1" class="anylinkcss">
<a href="http://www.dynamicdrive.com/">Dynamic Drive</a>
<a href="http://www.cssdrive.com">CSS Drive</a>
<a href="http://www.javascriptkit.com">JavaScript Kit</a>
<a href="http://www.codingforums.com">Coding Forums</a>
<a href="http://www.javascriptkit.com/jsref/">JavaScript Reference</a>
</div>


Here's a link to the page to see how it does not work: http://www.qdobanv.com/new_page_2.htm

CAN ANYONE SEE WHAT THE HECK I'M DOING WRONG?
vlane95678 is offline   Reply With Quote
Old 12-15-2005, 04:26 AM   PM User | #2
BaldEagle
Regular Coder

 
Join Date: Apr 2005
Location: Lisbon, CT
Posts: 339
Thanks: 0
Thanked 0 Times in 0 Posts
BaldEagle is an unknown quantity at this point
Code:
<a target="_self" href="index.htm">
<img name="image1" src="LanitechArtwork/button_home_off.gif" border="0" width="91" 
height="39" onmouseover="this.src='http://www.qdobanv.com/LanitechArtwork/button_home_on.gif';
dropdownmenu(this, event, 'anylinkmenu1');" 
onmouseout="this.src='http://www.qdobanv.com/LanitechArtwork/button_home_off.gif';" >
</a>
See if this works for you.

BaldEagle

Last edited by BaldEagle; 12-15-2005 at 02:58 PM..
BaldEagle is offline   Reply With Quote
Old 12-15-2005, 04:11 PM   PM User | #3
BaldEagle
Regular Coder

 
Join Date: Apr 2005
Location: Lisbon, CT
Posts: 339
Thanks: 0
Thanked 0 Times in 0 Posts
BaldEagle is an unknown quantity at this point
My last post will not work either. I apologize for not looking thoroughly before posting a response. It seems that your js is hijacking your onmouseout so you will probably have to modify it to take care of your image as well.

BaldEagle
BaldEagle is offline   Reply With Quote
Old 12-15-2005, 10:27 PM   PM User | #4
2reikis
Regular Coder

 
2reikis's Avatar
 
Join Date: Nov 2005
Location: California
Posts: 167
Thanks: 17
Thanked 13 Times in 13 Posts
2reikis is on a distinguished road
Question got me scratchin'

Jeez, it looks like it should work. It must be getting hung up in the .js file. Can you post that file.

Here's the weird thing. I copied your page source into a file on my computer, called it up in IE and it worked just fine. So the source of your problem is in anylink.js. That's the only thing I couldn't link to from your site. Maybe it needs a "return true" at the end?

Last edited by 2reikis; 12-15-2005 at 10:30 PM..
2reikis is offline   Reply With Quote
Old 12-16-2005, 12:32 AM   PM User | #5
Basscyst
Smokes a Lot


 
Join Date: Jul 2003
Location: CA, USA
Posts: 1,594
Thanks: 5
Thanked 20 Times in 20 Posts
Basscyst is on a distinguished road
Try giving the image(s) an id and referencing them with getElementById.

Code:
<a onmouseover="document.getElementById('image1').src='http://www.qdobanv.com/LanitechArtwork/button_home_on.gif', dropdownmenu(this, event, 'anylinkmenu1');" onmouseout="document.getElementById('image1').src='http://www.qdobanv.com/LanitechArtwork/button_home_off.gif';" target="_self" href="index.htm">
<img name="image1" id="image1" src="LanitechArtwork/button_home_off.gif" border="0" width="91" height="39"></a>
Better still would be to put it in a function:

Code:
<script type="text/javascript">
 function swapImage(obj_id,src)
   {
   	document.getElementById(obj_id).src=src
   }
</script>
<a onmouseover="swapImage('image1','LanitechArtwork/button_home_on.gif');dropdownmenu(this, event, 'anylinkmenu1');" onmouseout="swapImage('image1','LanitechArtwork/button_home_off.gif');" target="_self" href="index.htm">
<img name="image1" id="image1" src="LanitechArtwork/button_home_off.gif" border="0" width="91" height="39"></a>
Basscyst
__________________
Helping to build a bigger box. - Adam Matthews

Last edited by Basscyst; 12-16-2005 at 12:37 AM..
Basscyst is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:49 AM.


Advertisement
Log in to turn off these ads.