simple onMouseOver question

They have: 330 posts

Joined: Apr 2000

I am trying to create a function triggered by an onClick event which will change an image's src. Any help would be great.

Here's what I have and is not working. This function also changes the display properties of the currently viewed object.

<script language="javascript">

a1 = new Image()
a1.src = "../Images/Plus.gif"
a2 = new Image()
a2.src = "../Images/Minus.gif"

function expandIt(object,imgDocID,imgObjName){
    if(object.style.display == "none"){
    document.images[imgDocID].src = eval(imgObjName + ".src");
    object.style.display = "";
    }
    else {
    document.images[imgDocID].src = eval(imgObjName + ".src");
    object.style.display = "none";
    }
}
</script>
'

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Several times I tried to answer your question, but everytime I failed. I keep getting an 'object.style is not an object' error.
Can you please post the code that calls the function (onMouseover="blah")?

Shakespeare: onclick || !(onclick)

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.