473,413 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Error - working in IE and MOzilla but giving error null or not a object

gskoli
23
Error - working in IE and MOzilla but giving error null or not a object:
Guys i am giving you snippet of code , where it is javascript digital clock , It is showing time and working properly but it is giving error in log

Expand|Select|Wrap|Line Numbers
  1. function adidas(){ 
  2.     theTime=setTimeout('dotime();',1000);
  3.     ser_sc = ser_sc+1;
  4.     var hr= ser_hr+100 ;
  5.     var mn= ser_mn+100 ;
  6.     var se= ser_sc+100 ; 
  7.  
  8.     if(hr==100){
  9.         hr=112;am_pm='am';
  10.     }
  11.     else if(hr<112){
  12.         am_pm='am';
  13.     }
  14.     else if(hr==112){
  15.         am_pm='pm';
  16.     }
  17.     else if(hr>112){
  18.         am_pm='pm';hr=(hr-12);
  19.     }
  20.     tot=''+hr+mn+se;
  21.     document.hr1.src = '/flash_files/digits/dg'+tot.substring(1,2)+'.gif';// HERE IT IS GIVING ERROR
  22.     document.hr2.src = '/digits/dg'+tot.substring(2,3)+'.gif';
  23.     document.mn1.src = '/digits/dg'+tot.substring(4,5)+'.gif';
  24.     document.mn2.src = '/digits/dg'+tot.substring(5,6)+'.gif';
  25.     document.se1.src = '/digits/dg'+tot.substring(7,8)+'.gif';
  26.     document.se2.src = '/digits/dg'+tot.substring(8,9)+'.gif';
  27.     document.ampm.src= '/digits/dg'+am_pm+'.gif';
  28. }
  29. adidas();
  30.  
Help me out guys ....

Thanks in advance.
Jul 14 '10 #1
7 2089
gits
5,390 Expert Mod 4TB
what does the dotime()-method do? ... when do you start the script ... from the onload or directly when the page is read by the browser?
Jul 14 '10 #2
gskoli
23
Sorry , dotime() is adidas();
Jul 14 '10 #3
gits
5,390 Expert Mod 4TB
??? so that was the error? ... otherwise you should tell when the function is executed first. when it isn't first fired from the page's onload event then the DOM isn't reliably ready to be used and thus a node reference could fail with the error that you encounter.
Jul 15 '10 #4
gskoli
23
ya the function is called on onLoad ,
And might be this is the reason behind that , so any solution.
Jul 15 '10 #5
gits
5,390 Expert Mod 4TB
besides of the diff in the path i cannot see ond/or say anything without having a look at the surrounding code or better a testpage ...
Jul 16 '10 #6
gskoli
23
I am sorry but not getting you ... Can you please elaborate it again ...
Jul 17 '10 #7
gits
5,390 Expert Mod 4TB
in line 21 of the above posted code the path differs from the other img-paths - in case the path is correct then it would be relevant to see the rest of the code or better having a testpage. or install the firebug extension in firefox and tell what javascript error occurs ...

you might even check what the

document.hrX

nodes are during the execution ... just place an alert or log in the code. i suppose that those nodes are image-nodes? how does they look like in the code? probably it would be better to give them ids and retrieve them with the document.getElementById() method ...
Jul 18 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: toton | last post by:
Hi, In some cases when my function returns, I need to return a object of null state. This is when I return object by value. (Just like for by pointer, I can return a null pointer ). It has to be...
1
by: subvit | last post by:
function test_redirect(t,p) { 1) window.open("formappl.asp?id=1&apid="+t+"&prid="+p,'email','width=950,height=600,top=50,left=50'); 2) ...
1
by: urkel | last post by:
Hi everyone, I critically need help to solve this problem related to pointer in C++ Basically, I have a C/C++ program "retardselfenerg" calling a Fortran 90 subroutine "surfGF4.f90". i am so...
1
by: Rahul Bhate | last post by:
Hello Sir My problem is in dos giving error that javac is not recognised.Tell me the steps for debugging.I have already set the CLASSPTH through command line & also set the PATH.But still giving...
4
by: manjugi | last post by:
Hi, I am running som web application at some point i have one web page contains some buttons,text field etc.when i click on button it gives an error message stating that "error:...
4
by: Barnali85 | last post by:
Hi all, I am getting "The remote server returned an error: (500) Internal Server Error" exception. I have written the following code in VS.NET2005 using C# : WebRequest wr =...
3
by: svsenthilkumar | last post by:
hai , i got an error in javascript, when upload a file in a form, the code is working properly in IE but i got javascript error in Mozilla firefos what is mean by error and how to rectify...
1
by: JWest46088 | last post by:
I'm getting this error when I try to preview my code: TypeError: Error #1009: Cannot access a property or method of a null object reference. at therun4life_fla::MainTimeline/frame1() I don't...
4
rahuljaiswal1987
by: rahuljaiswal1987 | last post by:
var path = Components.classes.getService(Components.interfaces.nsIProperties).get('ProfD', Components.interfaces.nsIFile).path; var localFile =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.