help please ie based javascript problem

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Apr 2008
Posts: 75
Reputation: mustafaneguib is an unknown quantity at this point 
Solved Threads: 3
mustafaneguib mustafaneguib is offline Offline
Junior Poster in Training

help please ie based javascript problem

 
0
  #1
Jun 24th, 2008
hey guys how are you all?
i am recieving the following error in all my pages except my homepage on internet explorer.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. Line: 49
  2. Char: 1
  3. Error: 'null' is null or not an object
  4. Code: 0
  5. URL : http://www.worldofpakistan.net/register.phpLine: 49
  6. Char: 1
  7. Error: 'null' is null or not an object
  8. Code: 0
  9. URL : http://www.worldofpakistan.net/register.php

following is the page code.

  1. <!DOCTYPE html
  2. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  6.  
  7.  
  8. <head><title>MN Tech Solutions Blog Software--Registeration Page</title>
  9. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  10. <meta name="keyword" content="" />
  11. <meta name="description" content=" " />
  12. <meta http-equiv="content-language" content="en" />
  13.  
  14.  
  15. <script type="text/javascript" src="nifty.js"></script>
  16.  
  17.  
  18.  
  19. <!--Software House: MN Tech Solutions-->
  20. <!--Designer/Programmer: Mustafa Neguib-->
  21. <!--Date Project Started: 17th June 2008-->
  22. <?php
  23. include 'browsercheck.php';
  24. ?>
  25.  
  26. <style type="text/css">
  27. <!--
  28.  
  29.  
  30.  
  31. -->
  32. </style>
  33.  
  34.  
  35. </head>
  36. <body>
  37.  
  38.  
  39. <div id="div1">
  40.  
  41. <script type="text/javascript">
  42. window.onload=function(){
  43. if(!NiftyCheck())
  44. return;
  45. Rounded("div#first","#EFF6F9","#9BD1FA");
  46. Rounded("div#second","#EFF6F9","#9BD1FA");
  47. Rounded("div#third","#EFF6F9","#9BD1FA");
  48. }
  49. </script>
  50.  
  51. <div id="div2">
  52.  
  53. <div id="div8">
  54. <img src="logo.jpg" title="Banner" alt="Banner" />
  55. </div>
  56.  
  57. </div>
  58.  
  59. <div id="div3">
  60.  
  61. <div id="main">
  62. <ul>
  63. <li><a href="index.php" title="Home Page">Home Page</a></li>
  64. <li><a href="login.php?abcdghsjau=1" title="Login Page">Login</a></li>
  65. <li><a href="show.php" title="Read an Article">Read an Article</a></li>
  66.  
  67. </ul>
  68.  
  69. </div>
  70.  
  71. </div>
  72.  
  73.  
  74.  
  75.  
  76. <div id="div4">
  77. <div id="first">
  78. <h2>Registration Page</h2>
  79. <p>
  80. Please fill out the following form in order to register on this site.
  81. Also provide a real email address as we will send updates to you at the email address provided.
  82. </p>
  83.  
  84.  
  85. <form method="post" action="insertuser.php">
  86.  
  87. <p>
  88. First Name: <input type="text" name="fname" />
  89. </p>
  90. <p>
  91. Last Name: <input type="text" name="lname" />
  92. </p>
  93. <p>
  94. Username: <input type="text" name="username" />
  95. </p>
  96. <p>
  97. Password: <input type="password" name="password" />
  98. </p>
  99. <p>
  100. Email: <input type="text" name="email" />
  101. </p>
  102. <p>
  103. Country: <input type="text" name="country" />
  104. </p>
  105. <p>
  106. Age: <input type="text" name="age" />
  107. </p>
  108.  
  109. <p>
  110. <input type="submit" value="submit" name="Submit" />
  111.  
  112. <input type="reset" value="Clear All" name="reset" />
  113. </p>
  114.  
  115. </form>
  116.  
  117.  
  118. </div>
  119. </div>
  120.  
  121. <div id="div7">
  122. <?php include'copyright.html';?>
  123. </div>
  124.  
  125.  
  126.  
  127.  
  128. </div>
  129. </body>
  130. </html>

when i remove the following code from the page the error goes away, but when i put it back inside the error comes back.

  1. <script type="text/javascript">window.onload=function(){if(!NiftyCheck()) return;Rounded("div#first","#EFF6F9","#9BD1FA");Rounded("div#second","#EFF6F9","#9BD1FA"); Rounded("div#third","#EFF6F9","#9BD1FA"); }</script> <script type="text/javascript">window.onload=function(){if(!NiftyCheck()) return;Rounded("div#first","#EFF6F9","#9BD1FA");Rounded("div#second","#EFF6F9","#9BD1FA"); Rounded("div#third","#EFF6F9","#9BD1FA"); }</script>


the following is the javascript file contain teh function.

  1. function NiftyCheck(){
  2. if(!document.getElementById || !document.createElement)
  3. return(false);
  4. var b=navigator.userAgent.toLowerCase();
  5. if(b.indexOf("msie 5")>0 && b.indexOf("opera")==-1)
  6. return(false);
  7. return(true);
  8. }
  9.  
  10. function Rounded(selector,bk,color,size){
  11. var i;
  12. var v=getElementsBySelector(selector);
  13. var l=v.length;
  14. for(i=0;i<l;i++){
  15. AddTop(v[i],bk,color,size);
  16. AddBottom(v[i],bk,color,size);
  17. }
  18. }
  19.  
  20. function RoundedTop(selector,bk,color,size){
  21. var i;
  22. var v=getElementsBySelector(selector);
  23. for(i=0;i<v.length;i++)
  24. AddTop(v[i],bk,color,size);
  25. }
  26.  
  27. function RoundedBottom(selector,bk,color,size){
  28. var i;
  29. var v=getElementsBySelector(selector);
  30. for(i=0;i<v.length;i++)
  31. AddBottom(v[i],bk,color,size);
  32. }
  33.  
  34. function AddTop(el,bk,color,size){
  35. var i;
  36. var d=document.createElement("b");
  37. var cn="r";
  38. var lim=4;
  39. if(size && size=="small"){ cn="rs"; lim=2}
  40. d.className="rtop";
  41. d.style.backgroundColor=bk;
  42. for(i=1;i<=lim;i++){
  43. var x=document.createElement("b");
  44. x.className=cn + i;
  45. x.style.backgroundColor=color;
  46. d.appendChild(x);
  47. }
  48. el.insertBefore(d,el.firstChild);
  49. }
  50.  
  51. function AddBottom(el,bk,color,size){
  52. var i;
  53. var d=document.createElement("b");
  54. var cn="r";
  55. var lim=4;
  56. if(size && size=="small"){ cn="rs"; lim=2}
  57. d.className="rbottom";
  58. d.style.backgroundColor=bk;
  59. for(i=lim;i>0;i--){
  60. var x=document.createElement("b");
  61. x.className=cn + i;
  62. x.style.backgroundColor=color;
  63. d.appendChild(x);
  64. }
  65. el.appendChild(d,el.firstChild);
  66. }
  67.  
  68. function getElementsBySelector(selector){
  69. var i;
  70. var s=[];
  71. var selid="";
  72. var selclass="";
  73. var tag=selector;
  74. var objlist=[];
  75. if(selector.indexOf(" ")>0){ //descendant selector like "tag#id tag"
  76. s=selector.split(" ");
  77. var fs=s[0].split("#");
  78. if(fs.length==1) return(objlist);
  79. return(document.getElementById(fs[1]).getElementsByTagName(s[1]));
  80. }
  81. if(selector.indexOf("#")>0){ //id selector like "tag#id"
  82. s=selector.split("#");
  83. tag=s[0];
  84. selid=s[1];
  85. }
  86. if(selid!=""){
  87. objlist.push(document.getElementById(selid));
  88. return(objlist);
  89. }
  90. if(selector.indexOf(".")>0){ //class selector like "tag.class"
  91. s=selector.split(".");
  92. tag=s[0];
  93. selclass=s[1];
  94. }
  95. var v=document.getElementsByTagName(tag); // tag selector like "tag"
  96. if(selclass=="")
  97. return(v);
  98. for(i=0;i<v.length;i++){
  99. if(v[i].className==selclass){
  100. objlist.push(v[i]);
  101. }
  102. }
  103. return(objlist);
  104. }

please help
thanx in advance
Last edited by mustafaneguib; Jun 24th, 2008 at 3:57 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: help please ie based javascript problem

 
0
  #2
Jun 24th, 2008
I've never used that script but it sounds like this type of error:
I don't see <div>s that match up to these two lines:
  1. Rounded("div#second","#EFF6F9","#9BD1FA");
  2. Rounded("div#third","#EFF6F9","#9BD1FA");
Last edited by R0bb0b; Jun 24th, 2008 at 10:18 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 75
Reputation: mustafaneguib is an unknown quantity at this point 
Solved Threads: 3
mustafaneguib mustafaneguib is offline Offline
Junior Poster in Training

Re: help please ie based javascript problem

 
0
  #3
Jun 25th, 2008
the missing divs was the problem. the problem has been solved. thanx
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 815 | Replies: 2
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC