I have buttons that act funny and are not consistant. When
you mouse over it changes when you click it follows a
link. but sometimes it doesnt show the picture you click
it again then the picture comes back. click it a few more
times and the picture isnt there reclick it or click
another button and the picture comes back. radomly happens
to any button

function init() {
if (!document.getElementById) return
var imgOriginSrc;
var imgTemp = new Array();
var imgarr = document.getElementsByTagName('img');
for (var i = 0; i < imgarr.length; i++) {
if (imgarr[i].getAttribute('hsrc')) {
imgTemp[i] = new Image();
imgTemp[i].src = imgarr[i].getAttribute('hsrc');
imgarr[i].onmouseover = function() {
imgOriginSrc = this.getAttribute('src');
this.setAttribute('src',this.getAttribute
('hsrc'))
}
imgarr[i].onmouseout = function() {
this.setAttribute('src',imgOriginSrc)
}
}
}
}
onload=init;

</script>


<a href="index.htm">
<img border="0" src="webimage/button1.jpg"
hsrc="webimage/button1a.jpg"
align="left" width="120"
height="28"></a><p>&nbsp;</p>
<p>

<a href="news.htm">

<img border="0" src="webimage/button2.jpg"
hsrc="webimage/button2a.jpg"
align="left" width="120" height="28"></a></p>
<p>&nbsp;</p>
<p>

<a href="raceschedule.htm">

<img border="0" src="webimage/button3.jpg"
hsrc="webimage/button3a.jpg"
align="left" width="120" height="28"></a></p>
<p>&nbsp;</p>
<p>

<a href="directions.htm">

<img border="0" src="webimage/button4.jpg"
hsrc="webimage/button4a.jpg"
align="left" width="120" height="28"></a></p>
<p>&nbsp;</p>
<p>

<a href="joinwrcrw.htm">

<img border="0" src="webimage/button5.jpg"
hsrc="webimage/button5a.jpg"
align="left" width="120" height="28"></a></p>
<p>&nbsp;</p>
<p>

>-----Original Message-----
>What are some tricks for making your web site faster
>.
>

Re: makeing button change on mouse over by Stefan

Stefan
Fri Feb 20 04:09:18 CST 2004

Your script is relying on an unsupported attribute for the img tag (hsrc), which browsers will ignore
Find a more conventional mouseover script that also preload your images as in
http://javascript.internet.com/generators/preload-images.html
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


"Kelly**********" <anonymous@discussions.microsoft.com> wrote in message news:134d401c3f76f$8e35b1e0$a001280a@phx.gbl...
| I have buttons that act funny and are not consistant. When
| you mouse over it changes when you click it follows a
| link. but sometimes it doesnt show the picture you click
| it again then the picture comes back. click it a few more
| times and the picture isnt there reclick it or click
| another button and the picture comes back. radomly happens
| to any button
|
| function init() {
| if (!document.getElementById) return
| var imgOriginSrc;
| var imgTemp = new Array();
| var imgarr = document.getElementsByTagName('img');
| for (var i = 0; i < imgarr.length; i++) {
| if (imgarr[i].getAttribute('hsrc')) {
| imgTemp[i] = new Image();
| imgTemp[i].src = imgarr[i].getAttribute('hsrc');
| imgarr[i].onmouseover = function() {
| imgOriginSrc = this.getAttribute('src');
| this.setAttribute('src',this.getAttribute
| ('hsrc'))
| }
| imgarr[i].onmouseout = function() {
| this.setAttribute('src',imgOriginSrc)
| }
| }
| }
| }
| onload=init;
|
| </script>
|
|
| <a href="index.htm">
| <img border="0" src="webimage/button1.jpg"
| hsrc="webimage/button1a.jpg"
| align="left" width="120"
| height="28"></a><p>&nbsp;</p>
| <p>
|
| <a href="news.htm">
|
| <img border="0" src="webimage/button2.jpg"
| hsrc="webimage/button2a.jpg"
| align="left" width="120" height="28"></a></p>
| <p>&nbsp;</p>
| <p>
|
| <a href="raceschedule.htm">
|
| <img border="0" src="webimage/button3.jpg"
| hsrc="webimage/button3a.jpg"
| align="left" width="120" height="28"></a></p>
| <p>&nbsp;</p>
| <p>
|
| <a href="directions.htm">
|
| <img border="0" src="webimage/button4.jpg"
| hsrc="webimage/button4a.jpg"
| align="left" width="120" height="28"></a></p>
| <p>&nbsp;</p>
| <p>
|
| <a href="joinwrcrw.htm">
|
| <img border="0" src="webimage/button5.jpg"
| hsrc="webimage/button5a.jpg"
| align="left" width="120" height="28"></a></p>
| <p>&nbsp;</p>
| <p>
|
| >-----Original Message-----
| >What are some tricks for making your web site faster
| >.
| >