
hi there all is anyone able to help me out with a bit of javascript code? On my webpage:gmorrissey.kol.co.nz I have a page called page_template. I have only uploaded the red and black images for the first two buttons (a blue and a red button for mouseover). I dont think I have quite got the code right as the buttons arent changing colour on mouseover. I had an online script that I used as a template, I seemed to have gone awry for some reason. Any tips appreciated. Glenn.

Glenn Stuart Morrissey wrote:
hi there all
is anyone able to help me out with a bit of javascript code? On my webpage:gmorrissey.kol.co.nz I have a page called page_template. I have only uploaded the red and black images for the first two buttons (a blue and a red button for mouseover). I dont think I have quite got the code right as the buttons arent changing colour on mouseover. I had an online script that I used as a template, I seemed to have gone awry for some reason. Any tips appreciated.
Glenn.
_______________________________________________ wlug mailing list | wlug(a)list.waikato.ac.nz Unsubscribe: http://list.waikato.ac.nz/mailman/listinfo/wlug
you could do it this way but not using your array: <a href="mystory.html" onmouseover="mystory.src='images/mystory_down.png';" onmouseout="mystory.src='images/mystory_up.png';"> <img src="images/mystory_up.png" width="100" height="50" border="0" alt="Move your mouse over me" name="mystory" /> </a> using your code it needs tweaking: <SCRIPT LANGUAGE = "JavaScript"> <!-- mystory_on=new Image; mystory_on.src="./images/mystory_down.png"; mystory_off=new Image; mystory_off.src="./images/mystory_up.png"; --> note the ; at end then the body code: <a href="mystory.html" OnMouseOut="document.mystory.src=mystory_off.src"; OnMouseOver="document.mystory.src=mystory_on.src";> <img src="./images/mystory_up.png" name="mystory" width="100" height="50" border="1"></a> added the document tag, and ; and also each image needs to be called something different. you had both the same name. also you had a naming convention spelling mistake my_blog_on at top and in the <a> tag you called it myblog_on. that is a leading cause of mistakes. use a single naming convention throughout your project and it need not happen again. if you email me directly (haldor(a)zox.co.nz I can send you the reworked file. also I uploaded it to my site so you can check it out, along with comments in the html. http://www.zox.co.nz/glenn

You could also avoid JavaScript altogether and use CSS for rollover buttons. If it's just a simple background/foreground colour combination then you could try using an unordered list and formatting it appropriately. I have a good example of that if you're interested (I had to create such a system for the Observatory). Sandy Glenn Stuart Morrissey wrote:
hi there all
is anyone able to help me out with a bit of javascript code? On my webpage:gmorrissey.kol.co.nz I have a page called page_template. I have only uploaded the red and black images for the first two buttons (a blue and a red button for mouseover). I dont think I have quite got the code right as the buttons arent changing colour on mouseover. I had an online script that I used as a template, I seemed to have gone awry for some reason. Any tips appreciated.
Glenn.
participants (3)
-
Chakat Sandwalker
-
Glenn Stuart Morrissey
-
Haldor Riddering