FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

[help] document.getElementByID(...) is null or not an object

 


phicha
i need a hand, i just finished some ajax on my website.
but it seem i get a javascript error on my page.

please help me,
my new site is on www.ibe.com.my/new
after my page loading finished,
please click on Products Catalog Menu,
Bulldozer, then Caterpillar.

after finished the ajax loading, there will be a pop up message that show
"document.getElementByID(...) is null or not an object"

oh and i confused that, the error only show up one time, every the page full reloaded.

can some one check it for me ?

thanks,
Philip
alalex
if you just copied and pasted you have to remember that javascript is case-sensitive, and the syntax for that is:
Code:
document.getElementById(...)

with the Id this way, instead of ID.
I have read most of your source code, and that error is ok, you wrote it correctly, just make sure you wrote it perfectly...

Is there any function supposed to run onLoad? if so, post it here, we may find the error. Wink
phicha
i checked it already,
i don't have problem with case sensitive problem.

i just confused why after the ajax loaded for the first time *after click the product catalog menu*
and after my main page reloaded with ajax. the error come out for once time. and the error just show up one time every time the page refreshed.

Quote:
Is there any function supposed to run onLoad? if so, post it here, we may find the err

Err no i dont add any onLoad script.

Thanks alalex ^^,
Philip
Aredon
Code:

document.getElementById("featured").innerHTML=ITEMS1[IntFeatured];

change the above to:
Code:

var e=document.getElementById("featured");
if(e)e.innerHTML=ITEMS1[IntFeatured];


While you're at it, change:
Code:

document.getElementById("updated").innerHTML=ITEMS2[IntUpdated];

with:
Code:

var e=document.getElementById("updated");
if(e)e.innerHTML=ITEMS2[IntUpdated];
phicha
Thanks Aredon.
it's Working smoothly ^^
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.