Problem changing css background-image in javascript function
Posted: Mon Jan 22, 2007 2:14 pm
feyd | Please use
here is the javascript code:
Thanks for any help given.
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a menu file that I'm wanting to change images when you hover over the <a> tag, or when you press the mouse button. I thought I had it right but when the page loads up it acts like the javascript is malfunctioning. Here is my html tag.
[syntax="html"]
<dt id="menu1" onclick="javascript:show('smenu1');" onMouseOver="javascript:buttonUp('menu1');" onMouseDown="javascript:buttonDown('menu1');" onMouseUp="javascript:buttonUp('menu1');" onMouseOut="javascript:buttonFlat('menu1');">Employees</dt>
Code: Select all
function buttonUp(id){
document.getElementById(id).style.background-image='url("images/buttonUp.jpg")';
}
function buttonDown(id){
document.getElementById(id).style.background-image="url('images/buttonDown.jpg')";
}
function buttonFlat(id){
document.getElementById(id).style.background-image="url('images/buttonFlat.jpg')";
}
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]