Event JavaScript DHTML



onMouseDown and onMouseUp Event Handlers

if (document.images) {
    var RightNormImg = new Image(16,16)
    var RightUpImg = new Image(16,16)
    var RightDownImg = new Image(16,16)
    var LeftNormImg = new Image(16,16)
    var LeftUpImg = new Image(16,16)
    var LeftDownImg = new Image(16,16)
    RightNormImg.src = "http://www.rntsoft.com/style/logo.png"
    RightUpImg.src = "http://www.rntsoft.com/style/logoRed.png"
    RightDownImg.src = "http://www.rntsoft.com/style/logo.png"
    LeftNormImg.src = "http://www.rntsoft.com/style/logo.png"
    LeftUpImg.src = "http://www.rntsoft.com/style/logo.png"
    LeftDownImg.src = "http://www.rntsoft.com/style/logoRed.png"
}
function setImage(imgName, type) {
    if (document.images) {
        var imgFile = eval(imgName + type + "Img.src")
        document.images[imgName].src = imgFile
        return false
    }
}



onMouseDown and onMouseUp Event Handlers




Roll atop and click on the buttons to see how the link event handlers swap
 images:



    onMouseOver="return setImage('Left','Up')"
    onMouseDown="return setImage('Left','Down')"
onMouseUp="return setImage('Left','Up')"
    onMouseOut="return setImage('Left','Norm')"
>

  
    onMouseOver="return setImage('Right','Up')"
    onMouseDown="return setImage('Right','Down')"
    onMouseUp="return setImage('Right','Up')"
    onMouseOut="return setImage('Right','Norm')"
>