0

My code gives me an error only the first time when i press the checkbox. If i press it for the second time or just to uncheck the checkbox and it gives me the right answer.
Can you please help me, i tried almost everything. I use IE7, xampp with appache server and Windows7.

Message: 'null' is null or not an object
Line: 76
Char: 3
Code: 0

<!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">
<body>

<script language="javascript" type="text/javascript">

document.write("PDB1: <input type='text' name='workbenchPDB1' id='workbenchPDB1' size='4' maxlength='4'/>");
document.write("</br>");
document.write("PDB2: <input type='text' name='workbenchPDB2'  id='workbenchPDB2' size='4' maxlength='4'  />");
document.write("</div>");
document.write("<input type='checkbox' id='option4'  value='pw_fatcat' onclick='pairwise();'>jFatCat_rigid<br>");
document.write("</div>");
document.write("Try with this proteins :  3gys,2x4n,1crn,3gus,  1Q94   ,   1QEW  ,   1QLF 1QQD,1QR1,1QRN")
 
document.close();


function pairwise() {
//i put 127.0.0.1 as trusted sites and  Miscellaneous > Access Data across domains > Enable.


	var action='pw_fatcat';
	var pdbfile=encodeURIComponent(document.getElementById("workbenchPDB1").value);
	var pdbfile1=encodeURIComponent(document.getElementById("workbenchPDB2").value);
	var pdbfile2='a'
	var pdbfile3='a';	
	
	
	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 && ajaxRequest.status == 200){
			var xmlDoc = ajaxRequest.responseXML;
			
				var x=xmlDoc.getElementsByTagName("AFPChain")[0]; 
  var length_pdb1=x.getAttribute("ca1Length"); 
  var length_pdb2=x.getAttribute("ca2Length"); 
 document.write(length_pdb1);
 
		}
		else	
         {
         //   alert("Error: returned status code " + ajaxRequest.status);
         }	

	}
	
	ajaxRequest.open("GET","http://www.pdb.org/pdb/workbench/getaligned.do?action="+action+"&pdb1="+pdbfile+"&chain1="+pdbfile2+"&pdb2="+pdbfile1+"&chain2="+pdbfile3+"&type=xml",true);
	ajaxRequest.send(); 
	

}

</script>
</body>
</html>
1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by theheretic1984
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.