Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Client Side Scripting
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 09-22-2005, 07:43 AM
  #1
snapper
Adept (Level 5)
 
Join Date: Sep 2005
Location: At the seaside!
Posts: 45
iTrader: (0)
snapper is an unknown quantity at this point
onmouseover - what's missing

Am I missing something in the following preventing the mouseover and mouseclick from working?

<a href="finn%20enlarge.jpg" target="advimage" onMouseOut="Finn%20up.jpg" onMouseOver="Finn%20down.jpg" onMouseDown="Finn%20down.jpg"><img src="Finn%20up.jpg" border="0">

Don't know if it needs a Javascript command somewhere?

Style commands are q simple, as follows:
<style type="text/css">
<!--
a:link{
text-decoration: none;
}
a:hover {
color:#cccccc;
}

-->
</style>
snapper is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-22-2005, 08:22 AM
  #2
RysChwith
Super Guru
 
Join Date: Jun 2004
Posts: 4,117
iTrader: (0)
RysChwith will become famous soon enough
Yup, you're missing the JavaScript. I'm assuming you're trying to change the source of the image? You could probably do something like this:
Code:
onmouseout = "this.firstChild.src = 'Finn%20up.jpg" onmouseover = "this.firstChild.src = 'Finn%20down.jpg"
Note 1: event handlers should be in all lower case, I think (someone correct me if I'm wrong, please).

Note 2: you don't need the onmousedown handler, since it's impossible to fire while the mouse isn't over the button.

Rys
RysChwith is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-22-2005, 08:56 AM
  #3
snapper
Adept (Level 5)
 
Join Date: Sep 2005
Location: At the seaside!
Posts: 45
iTrader: (0)
snapper is an unknown quantity at this point
Any way of getting around using Java? IE views them as popups which are blocked on my pc and I would assume on many others.
snapper is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-22-2005, 09:09 AM
  #4
jonirvine
Paladin (Level 15)
 
jonirvine's Avatar
 
Join Date: Oct 2000
Location: York, UK
Posts: 337
iTrader: (0)
jonirvine is on a distinguished road
Quote:
Originally Posted by snapper
Any way of getting around using Java? IE views them as popups which are blocked on my pc and I would assume on many others.
To do without javascript, you can use background images for the links and change them onhover with CSS.

eg:

Code:
<style type="text/css">
<!--
a:link{
display: block; width: 100px; height: 25px;
background-image: url(finn%20enlarge.jpg); background-position: 0 0; background-repeat: no-repeat;
text-decoration: none;
}
a:hover {
background-image: url(finn%20enlarge2.jpg);
}
-->
</style>
jonirvine is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-22-2005, 09:13 AM
  #5
snapper
Adept (Level 5)
 
Join Date: Sep 2005
Location: At the seaside!
Posts: 45
iTrader: (0)
snapper is an unknown quantity at this point
Trouble is, have several different images (acting as icons), all of which have links to JPGs which open in another frame. Sticking with Java for a moment, have edited the code to the following, but I need the JPG 'Evie%20down.jpg' to remain in place until the user clicks on another image/icon. Is there anything like 'onunclick'??? (thanks for bearing with me - this is only day 7 of the learning curve!)

<a href="evie%20enlarge.jpg" target="advimage" onmouseover="evie.src='Evie%20down.jpg'" onclick="evie.src='Evie%20down.jpg'" onmouseout="evie.src='Evie%20up.jpg'"><img src="Evie%20up.jpg" name="evie" border="0" id="evie">

Last edited by snapper : 09-22-2005 at 09:26 AM.
snapper is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-22-2005, 01:25 PM
  #6
RysChwith
Super Guru
 
Join Date: Jun 2004
Posts: 4,117
iTrader: (0)
RysChwith will become famous soon enough
CSS only gives you the possibility of changing it for hover. Anything else is going to require JavaScript. Note that event handlers -- onmouseover, onmouseout, etc. -- are inherently JavaScript properties. They're specifically designed to call JavaScript functions, and nothing else*.

I will point out that IE's probably only going to block them when executed from your local hard drive. Once you upload it to the site, it'll be fine with it. Just one of its entertaining little quirks.

Rys

* Well, you might be able to use them with VBScript as well, but I couldn't swear to that.
RysChwith is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-23-2005, 12:30 AM
  #7
steverz
Soldier (Level 11)
 
Join Date: Aug 2005
Posts: 111
iTrader: (0)
steverz is an unknown quantity at this point
Maybe show us your complete code or webpage so we can take a look at your code.

Yes, vbScript would work as well.
Code:
<script language=vbscript>
Sub namehere_onMouseOver
            namehere.Style.Background-Image = "url('./image.jpg')"
End Sub
Sub namehere_onMouseOut
            namehere.Style.Background-Image = "url('./image.jpg')"
End Sub
</script>
It may be
Code:
namehere.Style.BackgroundImage = "url('./image.jpg')"
I can't remember atm.

<a href="evie%20enlarge.jpg" target="advimage" id="namehere"><img src="Evie%20up.jpg" name="evie" border="0" id="evie">

What your looking for is the onBlur(onunclick) handler.

Last edited by steverz : 09-23-2005 at 12:34 AM.
steverz is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-23-2005, 06:45 AM
  #8
snapper
Adept (Level 5)
 
Join Date: Sep 2005
Location: At the seaside!
Posts: 45
iTrader: (0)
snapper is an unknown quantity at this point
Thanks for help - going to stick with Java and try it out when uploaded.
snapper is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-23-2005, 08:34 AM
  #9
RysChwith
Super Guru
 
Join Date: Jun 2004
Posts: 4,117
iTrader: (0)
RysChwith will become famous soon enough
Onblur is a little bit different. It fires any time a form element loses focus. This doesn't necessarily involve the mouse, though. It only applies to form elements, windows, and frames. It can be triggered by tabbing off the element in question, or by clicking anywhere that isn't the element, which doesn't necessarily mean the user has clicked on one of the other options.

Rys
RysChwith is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-23-2005, 08:43 AM
  #10
Bill Posters
Catapulted
 
Join Date: May 2003
Posts: 610
iTrader: (0)
Bill Posters is on a distinguished road
Quote:
Originally Posted by RysChwith
Onblur is a little bit different. It fires any time a form element loses focus. This doesn't necessarily involve the mouse, though. It only applies to form elements, windows, and frames.
Not so. It can be used on any element which is capable of taking the focus. Importantly - crucially from a keyboard user's pov - that also includes links.
Bill Posters is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 12:21 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.