Basically I did a rollover in css but i want it in javascript instead. Also I want,once my page is loaded one of the pictures would be automatically selected. I tried this code for that but its not working.. any ideas? for some reason its not calling the function. ps: the id is called clicked3 as well in my html
<script type="text/javascript">
window.onLoad=function(){
clicked3();
}
function clicked3(){
document.getElementById("clicked3").style.backgroundPosition = "-198px top";
}
</script>
The real reason your code isn't working is because you're assigning your function to a non-existent event handler onLoad
. window.onload
is the correct syntax, notice it's all lower case.