<img alt="move right" src="Pictures/sides/right.gif" id="MoveRight"
onclick="moveObjRight('ground','sky','mountain');myFunction2();myFunction3();myFunction4();myFunction5();"
style="z-index: 1; left: 801px; top: 37px; position: absolute; height: 33px;
width: 34px;" />
or
<script type="text/javascript">
window.onload = function() {
var ele = document.getElementById('MoveRight');
ele.onclick = function() {
moveObjRight('ground','sky','mountain');
myFunction2();
myFunction3();
myFunction4();
myFunction5();
}
};
</script>
Note that the second option will override any previously assigned window.onload
and ele.onclick
function. If you are using a javascript library use the appropriate dom ready event (e.g. jQuery: $(document).ready(function(){/*code*/});
or short: $(function(){/*code*/})
)