Jump to content

Unknown Runtime error?!?!?!


ionik

Recommended Posts

Ive tried figuring this out for a while now and since IE just throws a wonderful Unknown runtime ERROR it has completely stumped me.

 

I am simply inserting text using document.getElementById().innerHTML

 

The text I am trying to insert is just plain text accept or stop.

 

the error is produced at

document.getElementById(gShow).innerHTML = sResults;

 

and im inserting text into

<csystem id="name" title="40178" class="rules">  </csystem>

 

Ive used this exact javascript countless times before with no problems......any suggestions on what is wrong here?

 

<!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>
   <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>cSystem AACP V.5.1.0A</title>
<link href="images/favicon.png" rel="icon" />
<script type="text/javascript">
// Load Csystem HTML Tag
document.createElement("csystem");

// Validation
// This is a Ajax Validation request

window.onload = pageLoad;


var gShow; //variable holding the id where feedback will be sent to.
var sUrl = "index.php?page=validate&val="; //url is the page which will be processing all of the information.  it is important to make sure validationtype is ajax
var gErrors = 0; //number of errors is set to none to begin with
var http = getHTTPObject(); //don't worry about this


var objInput = document.getElementsByTagName('input');

function ieCheck()
{
   return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}

function attachFormHandlers()
{
var form = document.getElementById('csystem_form')
for ( var iCounter=0; iCounter<objInput.length; iCounter++)
objInput[iCounter].onblur = function()
									{
										return validateMe(this);
									}
//attach the onchange to each input field
//form.onsubmit = function(){return validate();} //attach validate() to the form
}

function pageLoad()
{
attachFormHandlers();
document.createElement("csystem");
var objInput = document.getElementsByTagName('input');
for ( var iCounter=0; iCounter<objInput.length; iCounter++) {
return validateMe(objInput[iCounter]);
}
}


// groupId Selection used to check for validation if they have sponsor or publisher and dont have everything done in
// var selectValue = document.register.groupId.value;

function validateMe(objInput) {

sVal = objInput.value;
sRules = objInput.title.split(' ');
sRequired = sRules[1];
sTypeCheck = sRules[2];
   gShow = sRules[3];
if (sRequired == 'req')
{
	 http.open("GET", sUrl + (sVal) + "&req=" + (sRequired) + "&type=" + sTypeCheck, true);
	 http.onreadystatechange = handleHttpResponse; 	// what to do with the feedback
	 http.send(null);
}
}



function handleHttpResponse()
{
// if the process is completed, decide to do with the returned data
if (http.readyState == 4)
 	{
	sResults = http.responseText;
	alert(sResults);
	document.getElementById(gShow).innerHTML = sResults;
	validate();
 	}
}


function validate()
{

var tables = null;

document.createElement("csystem");

tables = document.getElementsByTagName('csystem');

for (i=0; i<tables.length; i++) // loop through all the elements
{
	// if the class name of that element is rules check to see if there are error warnings
	var accept = tables[i].innerHTML.match('accept');
	var alert = tables[i].innerHTML.match('alert');

	if (tables[i].className == "rules")
	{
		var inputId = tables[i].title;
		// IE creates a stupid bug here...
		//tables[i].innerHTML == '<img src="/images/icons/icon_accept.gif" align="absmiddle">' || tables[i].innerHTML == '<IMG src="http://mehype.com/images/icons/icon_accept.gif" align=absMiddle>'
		if (accept)
		{
			//tables[i].innerHTML = ' <img src="/csystem/images/icons/icon_accept.gif" class="midAlign">';
			document.getElementById(inputId).className = "";
		}
		else if (alert)
		{
			gErrors = gErrors + 1;
			//tables[i].innerHTML = ' <img src="/csystem/images/icons/icon_alert.gif" class="midAlign">';
			document.getElementById(inputId).className = "error";

		}
		else
		{
			gErrors = gErrors + 1; //the error count increases by 1
		  // tables[i].innerHTML = ' <img src="/csystem/images/icons/action_stop.gif" class="midAlign">';
		   document.getElementById(inputId).className = "error";
		}
	}
}

if (gErrors > 0)
{
	return false;
}
else
{
    gErrors = 0;
	//document.getElementById('submitbutton').disabled = false;
	return true;
	// going to check if display name is empty if it is fill it in with the value of username!
}

}

function submitForm()
{
   if (validate() == false)
   {
	alert('Please correct all required fields');
   }
}



function getHTTPObject()
{
var xmlhttp;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try
	{
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
	xmlhttp = false;
	}
}
return xmlhttp;
}
</script>
</head>
<body>
<!---DISPLAY MESSGAE IF RESO IS TO LESS THAN 1024*768 --->
<!--- DELETE CONFIRMATION -->
<form action="admin.php?page=forums&func=add"  id="csystem_form" method="post" name="cs_settings" class="form_input">
   <input name="name" id="40178" title="validate req notnull name" type="text" value="" /><csystem id="name" title="40178" class="rules">  </csystem>
<h2><input type="submit" name="submit" onClick="submitForm(); return false;"  value="Add Forum" /></h2></form>
</body>
</html>

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.