hey guys, the browser gives the following error when i open my webpage.

Line: 49
Char: 1
Error: 'null' is null or not an object
Code: 0
URL : http://www.worldofpakistan.net/register.php

the code of the page is as follows:

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<head><title>MN Tech Solutions Blog Software--Registeration Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keyword" content="" />
<meta name="description" content=" " />
<meta http-equiv="content-language" content="en" />


<script type="text/javascript" src="nifty.js"></script> 

<!--Software House: MN Tech Solutions-->
<!--Designer/Programmer: Mustafa Neguib-->
<!--Date Project Started: 17th June 2008-->
<?php
include 'browsercheck.php';
?>

<style type="text/css">
<!--



-->
</style>


</head>
<body>


<div id="div1">
<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> 

<div id="div2">

<div id="div8">
<img src="logo.jpg" title="Banner" alt="Banner" />
</div>

</div>

<div id="div3">

<div id="main">
<ul>
<li><a href="index.php" title="Home Page">Home Page</a></li>
<li><a href="login.php?abcdghsjau=1" title="Login Page">Login</a></li>
<li><a href="show.php" title="Read an Article">Read an Article</a></li>

</ul>

</div>

</div>




<div id="div4">
<div id="first">
<h2>Registration Page</h2>
<p>
Please fill out the following form in order to register on this site.
Also provide a real email address as we will send updates to you at the email address provided.
</p>


<form method="post" action="insertuser.php">

<p>
First Name: <input type="text" name="fname" />
</p>
<p>
Last Name: <input type="text" name="lname" />
</p>
<p>
Username: <input type="text" name="username" />
</p>
<p>
Password: <input type="password" name="password" />
</p>
<p>
Email: <input type="text" name="email" />
</p>
<p>
Country: <input type="text" name="country" />
</p>
<p>
Age: <input type="text" name="age" />
</p>

<p>
<input type="submit" value="submit" name="Submit" />

<input type="reset" value="Clear All" name="reset" />
</p>

</form>


</div>
</div>

<div id="div7">
<?php include'copyright.html';?>
</div>




</div>
</body>
</html>

the same error is coming on all my pages, except my home page which is quite puzzling as that area of error is the same for all the pages.

thanx in advance

I guess the error has something to do with the script browsercheck.php because I don't see anything strange on line 49 of this script.

i think the error is in the following code.

<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>

because when i removed this piece of code the error didnt occur, but when i put it backinthe error came back. this code is actually part of the rounding corners javascript code.


following is the javascript file that contains teh function definition of the function call in teh small piece of code.
note also this problemisnt happening with the index.php which is quite puzzling as it also has tha same code in it.

function NiftyCheck(){
if(!document.getElementById || !document.createElement)
    return(false);
var b=navigator.userAgent.toLowerCase();
if(b.indexOf("msie 5")>0 && b.indexOf("opera")==-1)
    return(false);
return(true);
}

function Rounded(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
var l=v.length;
for(i=0;i<l;i++){
    AddTop(v[i],bk,color,size);
    AddBottom(v[i],bk,color,size);
    }
}

function RoundedTop(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
    AddTop(v[i],bk,color,size);
}

function RoundedBottom(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
    AddBottom(v[i],bk,color,size);
}

function AddTop(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn="r";
var lim=4;
if(size && size=="small"){ cn="rs"; lim=2}
d.className="rtop";
d.style.backgroundColor=bk;
for(i=1;i<=lim;i++){
    var x=document.createElement("b");
    x.className=cn + i;
    x.style.backgroundColor=color;
    d.appendChild(x);
    }
el.insertBefore(d,el.firstChild);
}

function AddBottom(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn="r";
var lim=4;
if(size && size=="small"){ cn="rs"; lim=2}
d.className="rbottom";
d.style.backgroundColor=bk;
for(i=lim;i>0;i--){
    var x=document.createElement("b");
    x.className=cn + i;
    x.style.backgroundColor=color;
    d.appendChild(x);
    }
el.appendChild(d,el.firstChild);
}

function getElementsBySelector(selector){
var i;
var s=[];
var selid="";
var selclass="";
var tag=selector;
var objlist=[];
if(selector.indexOf(" ")>0){  //descendant selector like "tag#id tag"
    s=selector.split(" ");
    var fs=s[0].split("#");
    if(fs.length==1) return(objlist);
    return(document.getElementById(fs[1]).getElementsByTagName(s[1]));
    }
if(selector.indexOf("#")>0){ //id selector like "tag#id"
    s=selector.split("#");
    tag=s[0];
    selid=s[1];
    }
if(selid!=""){
    objlist.push(document.getElementById(selid));
    return(objlist);
    }
if(selector.indexOf(".")>0){  //class selector like "tag.class"
    s=selector.split(".");
    tag=s[0];
    selclass=s[1];
    }
var v=document.getElementsByTagName(tag);  // tag selector like "tag"
if(selclass=="")
    return(v);
for(i=0;i<v.length;i++){
    if(v[i].className==selclass){
        objlist.push(v[i]);
        }
    }
return(objlist);
}

Umm..Then you should post your question in javascript forum..

ok will do, one thing. this error does not come in firefox. maybe its the internet explorer which is causing the problems.

thanx for the help.

:S hmm..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.