Jump to content

Javascript document value is null.


GB_001

Recommended Posts

Hello,

I keep getting an error pertaining to the document.Reggy values.

stating that they are either null or not an object. The places where the errors are, are indicated with arrows.

 

Thankyou,

-GB

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<sc language='javascript' type='text/javascript'>
<!--
//
function rawr(){
var ajaxRequest; // The variable that makes Ajax possible!

try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) {
try{
ajaxRequest = new ActiveXObject('Microsoft.XMLHTTP');
} catch (e){
// Something went wrong
alert('Your browser broke!');
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){

var ajaxDisplay = document.getElementById('mainiac');
ajaxDisplay.innerHTML = ajaxRequest.responseText;

}

}
var url = 'Users.php';
[b]var f=document.Reggy.F.value;<------
var l=document.Reggy.L.value;<------
var s=document.Reggy.S.value;<------
var e=document.Reggy.E.value;<------
var p=document.Reggy.P.value;[/b];<------
var u = '?f='+f+'&l='+l+'&s='+s+'&e='+e+'&p='+p;
ajaxRequest.open('GET', url, true);
ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajaxRequest.send(null);
}
//-->
</s>
</head>
<body>
<table align=right>
<tr>
<td style="background:url(bmain4.png) repeat-x; border: 1px solid white; text-align:bottom; color: #FFFFFF;"><b><center>Register</center></b><br>
[b]<form name="Reggy" id="Reggy"/>
<font color=white><b>First Name:</b><br> <input name="F" id="F" type="text" value="" size="20"/><br><------
<b>Last Name:</b><br> <input name="L" id="L" type="text" size="20" value=""/><br><------
<b>Email:</b><br> <input name="E" id="E" type="text" size="20" value="" /><br><------
<b>School Or Office:</b><br> <input name="S" id="S" type="text" size="20" value="" /><br><------
<b>Password:</b><br> <input name="P" id="P" type="password" size="20" value="" /><br></font><------
</form>[/b]
<font color=black><b style="background-color:#AAAAAA; cursor: pointer;" onclick=rawr();>Submit</b>
</td>
</tr>
</table>
</body>
</html>

Link to comment
Share on other sites

The code would be much easier to debug if it was propery indented to follwo the structure. I did go through it and found several problems which solved some of the problems.

 

1. The opening and closing script tags are wrong. The opening script tag uses "sc" and the closing uses just "s"

 

2. There is BBCode bold tags within the script ( & ).

Link to comment
Share on other sites

I put sc because of the security on the site.

ans I tried the bold the code for it to be easier to see

 

This site has [ code ] tags for the specific purpose of being able to properly "display" code as opposed to having it interpreted. Also, bold tags don't work in code tags.

Link to comment
Share on other sites

After I fixed the problems I already described I did not get any errors on the lines you showed above. I then rec'd an error on the last line of the javascript (i.e. the null).

 

Since I do not have access to the external script being called I can't determine if the error is in this code or what is being returned from the external code.

Link to comment
Share on other sites

Nevertheless, I still get errors on different lines than you state above. I get the following errors:

 

Line 33:

ajaxDisplay.innerHTML = ajaxRequest.responseText;

'null' is null or not an object

 

Line 48:

ajaxRequest.send(null);

The system cannot locate the resource specified

 

So, I have to assume that the errors you are getting are different because of the external code. That's not to say there is a problem with the external code, just that it is difficult to properly debug without it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.