i have a picture the is setting on the event onload :
function hideMe() {
document.getElementById("navy1").style.display = "none";
}
and i have another function that setting the picture on the screen:
function setUpPicture() {
subRunnerOBJ = new Object();
subRunnerOBJ.topPos = 100;
subRunnerOBJ.leftPos = 0;
subRunnerOBJ.velX = 400;
subRunnerOBJ.velY = 0;
subRunnerOBJ.score = 0;
snImgObj = document.getElementById("navy1");
//in this point im getting the messge "Microsoft JScript runtime error: Unable to get value of the property 'style': object is null or undefined"
snImgObj.style.left = subRunnerOBJ.leftPos + "px";
snImgObj.style.top = subRunnerOBJ.topPos + "px";
snImgObj.style.position = "absolute";
snImgObj.style.display = "show";
startMovePicture();
any idea why this happan?
//this one will set the the pictue on the right side of the screen
function setUpPicture() {
subRunnerOBJ = new Object();
subRunnerOBJ.topPos = 100;
subRunnerOBJ.leftPos = 0;
subRunnerOBJ.velX = 400;
subRunnerOBJ.velY = 0;
subRunnerOBJ.score = 0;
//document.getElementById("navy1").style.display = "show";
snImgObj = document.getElementById("navy1");
snImgObj.style.left = subRunnerOBJ.leftPos + "px";
snImgObj.style.top = subRunnerOBJ.topPos + "px";
snImgObj.style.position = "absolute";
snImgObj.style.display = "show";
//once we place the location of the sub , we will Call to new function that will move it
startMovePicture();
}
function startMovePicture() {
dt = 50; // in miliseconds
h = setInterval("moveObj(subRunnerOBJ)", dt);
}
function moveObj(someObj) {
counter = 0;
while (counter < 3000) {
subRunnerOBJ.leftPos = subRunnerOBJ.leftPos + subRunnerOBJ.velX * dt / 1000;
subRunnerOBJ.topPos = subRunnerOBJ.topPos + subRunnerOBJ.velY * dt / 1000;
snImgObj.style.left = subRunnerOBJ.leftPos + "px";
snImgObj.style.top = subRunnerOBJ.topPos + "px";
counter = counter + 50;
if (counter == 3000) {
stopRunning()
}
}
}
function stopRunning() {
clearInterval(h);
hideMe();
}
//this function will hide the pucture on liad , and once the loop with the Pictue Running will end
//once loading the page we will not see the Picture
function hideMe() {
document.getElementById("navy1").style.display = "none";
}
}