errors when I run In my PC but not in the server

Hello I have a web site that when I run inmy pc with visual studio 2010 I get a warning:

"Runtime Error in Microsoft JScript: Can not set value of the property 'className': object is null or undefined"

the code is

           var menuSelected = 5;
               items[menuSelected].className = "selected";

but If I push "continue" the proyect runs fine. And when I upload to the server All works fine.

My problem is that is very disturbing to see this message constantly and have to click to continue
limmontreefreeAsked:
Who is Participating?
 
Amitkumar PConnect With a Mentor Sr. ConsultantCommented:
such errors occur when a java script code is executed on a object which not loaded or initialized. in other words, javascript is started executing before loading the entire webpage.

please check at your end. To check, you can add a timer in the function, so that it can function will execute after some time. generally, javascript function calls are written at the end of web page to avoid such issue.
0
 
limmontreefreeAuthor Commented:
Thanks I'll try and tell You.
0
 
limmontreefreeAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.