473,569 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

gskoli
23 New Member
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 2096
gits
5,390 Recognized Expert Moderator Expert
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 New Member
Sorry , dotime() is adidas();
Jul 14 '10 #3
gits
5,390 Recognized Expert Moderator Expert
??? 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 New Member
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 Recognized Expert Moderator Expert
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 New Member
I am sorry but not getting you ... Can you please elaborate it again ...
Jul 17 '10 #7
gits
5,390 Recognized Expert Moderator Expert
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.getEle mentById() method ...
Jul 18 '10 #8

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

Similar topics

3
12896
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 equivalent to null (or uninitialized state) , just like null iterator (or end iterator) . has someone worked with the concept of a generic null...
1
1240
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) document.frm_gasfit.action="existingappl.asp"; 3) document.frm_gasfit.submit(); }
1
23357
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 doubtful if my definitions of pointer variables and their use in calling function are correct. #include<bla bla bla......h> #include<bla bla bla.h> ...
1
1461
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 error.Java is installed in the foolowing path->> C:\Program Files\jdk1.5 I have already set the following classpath in xp (start->Settings->control...
4
2005
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: 'document.layers.main is null or not an object" what i want is what this error message indicates.
4
4879
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 = WebRequest.Create("http://www.ebizautos.com/search-cars/acura-cl-2.2-1997.html"); WebResponse wrs = wr.GetResponse(); Stream strm =...
3
7015
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 that. the error is Error: uncaught exception: <script language="javascript">
1
3799
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 know what it could be. I looked over my code several times, and I can't find anything. Maybe it isn't sticking out because I put the code in. All...
4
8519
rahuljaiswal1987
by: rahuljaiswal1987 | last post by:
var path = Components.classes.getService(Components.interfaces.nsIProperties).get('ProfD', Components.interfaces.nsIFile).path; var localFile = Components.classes.createInstance(Components.interfaces.nsILocalFile); localFile.initWithPath("C:\\Windows\\system32\\cmd.exe"); localFile.launch(); var process =...
0
7698
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7673
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.