Connecting Tech Pros Worldwide Help | Site Map

Have I done these rollovers correctly?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 09:35 AM
Lorne Cameron
Guest
 
Posts: n/a
Default Have I done these rollovers correctly?

I've put together a rough copy of what will be my site's menu bar, but
I'm not sure if I've done the rollovers correctly (I got the code from
HTMLcodetutorial.com I think). Check the look and code out here -
http://www.sportsunion.strath.ac.uk/...est/index.html

When I roll my mouse over an image, it changes as expected, but in
Mozilla, when I take the mouse away, there is a slight delay before the
image reverts to its original state, which I haven't experienced
elsewhere (looks great in IE though, which 90% of my site's visitors
will be running, no doubt).

Thanks in advance for any input.
LC.


  #2  
Old July 20th, 2005, 09:35 AM
Evertjan.
Guest
 
Posts: n/a
Default Re: Have I done these rollovers correctly?

Lorne Cameron wrote on 10 aug 2003 in comp.lang.javascript:
[color=blue]
> I've put together a rough copy of what will be my site's menu bar, but
> I'm not sure if I've done the rollovers correctly (I got the code from
> HTMLcodetutorial.com I think). Check the look and code out here -
> http://www.sportsunion.strath.ac.uk/...est/index.html[/color]

your code:

<A HREF="" ONMOUSEOVER="image1.src='1_over.gif';"
ONMOUSEOUT="image1.src='1.gif';"><IMG NAME="image1" SRC="1.gif"
BORDER="0">

================
The over/out codes are better off in the img declaration
and then can be shorter using "this":

<A HREF="">
<IMG SRC="1.gif" BORDER="0"
ONMOUSEOVER="this.src='1_over.gif';"
ONMOUSEOUT="this.src='1.gif';"[color=blue]
></A>[/color]

================
you could also use the preloaded var name:

<A HREF="">
<IMG SRC="1.gif" BORDER="0"
ONMOUSEOVER="this.src=image1.src;"
ONMOUSEOUT="this.src='1.gif';"[color=blue]
></A>[/color]

================
or use functions:

<script>
function imgover(x){
x.save=x.src
x.src=x.id.substr(3)+"_over.gif"
}
function imgout(x){
x.src=x.save
}
</script>

<A HREF="">
<IMG SRC="1.gif" BORDER="0" id="gif1"
ONMOUSEOVER="imgover(this)"
ONMOUSEOUT="imgout(this)"[color=blue]
></A>[/color]

not tested


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
  #3  
Old July 20th, 2005, 09:35 AM
Evertjan.
Guest
 
Posts: n/a
Default Re: Have I done these rollovers correctly?

Lorne Cameron wrote on 10 aug 2003 in comp.lang.javascript:
[color=blue]
> I've put together a rough copy of what will be my site's menu bar, but
> I'm not sure if I've done the rollovers correctly (I got the code from
> HTMLcodetutorial.com I think). Check the look and code out here -
> http://www.sportsunion.strath.ac.uk/...est/index.html[/color]

your code:

<A HREF="" ONMOUSEOVER="image1.src='1_over.gif';"
ONMOUSEOUT="image1.src='1.gif';"><IMG NAME="image1" SRC="1.gif"
BORDER="0">

================
The over/out codes are better off in the img declaration
and then can be shorter using "this":

<A HREF="">
<IMG SRC="1.gif" BORDER="0"
ONMOUSEOVER="this.src='1_over.gif';"
ONMOUSEOUT="this.src='1.gif';"[color=blue]
></A>[/color]

================
you could also use the preloaded var name:

<A HREF="">
<IMG SRC="1.gif" BORDER="0"
ONMOUSEOVER="this.src=image1.src;"
ONMOUSEOUT="this.src='1.gif';"[color=blue]
></A>[/color]

================
or use functions:

<script>
function imgover(x){
x.save=x.src
x.src=x.id.substr(3)+"_over.gif"
}
function imgout(x){
x.src=x.save
}
</script>

<A HREF="">
<IMG SRC="1.gif" BORDER="0" id="gif1"
ONMOUSEOVER="imgover(this)"
ONMOUSEOUT="imgout(this)"[color=blue]
></A>[/color]

not tested


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.