Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unexpected call to method or property

Status
Not open for further replies.

Mpdreamz

Programmer
Jan 17, 2005
14
DE
I get this whenever i try to alter an object in IE. The weird thing is that any function that only gets information works (such as alerting nodeValue) but whenever i try to alter the object (such as appendchild) to the object i get IE saying "Unexpected call to method or property" whilst it works fine in mozzilla.
The following works fine in FF but not in IE:
Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test</title>
</head>
<body>


<div type="prog_title">Test</div>
<div type="window_title">Relaties</div>
<div type="header" sql="SELECT * FROM tblRelaties">
	<control type="editbox" fieldname="RelatieID" disabled="true"> ID: </control>

	<control type="editbox" fieldname="Naam"></control>
	<control type="editbox" fieldname="Achternaam" validation="manditory"></control>
	<control type="editbox" fieldname="WerknemersNo" validation="numeric"></control>
	<control type="editbox" fieldname="Bedrijf"></control>
</div>
<a href="javascript:handle()">CLICK</a>
</body>
<script type="text/javascript">
function handle() { 
	var divs = document.getElementsByTagName("DIV");
	var output = document.getElementsByTagName("OUTPUT");
	for (i = 0; i < divs.length; i++) {
		var type = divs[i].getAttributeNode('type').nodeValue
		if (type == "header") { 
			var control = divs[i].getElementsByTagName("CONTROL")
			for (c = 0; c < control.length; c++) {
				type = control[c].getAttributeNode('type').nodeValue
				if (type = "editbox") control[c].appendChild(document.createElement('input'));
	
				
			}
		}
	}
}
</script>
</html>
if (type = "editbox") control[c].appendChild(document.createElement('input'));

Is the line that bugs, if you change it into
if (type = "editbox") alert(control[c].getAttributeNode('fieldname').nodeValue);

IE picks the object up just fine all off a sudden.

What am i doing wrong ?
 
That didn't work despite my bitter hope it was such a simple mistake on my part. I still get the error in IE while in FF it works totally as expected.

Setting properties of the elements in the array control bugs where as returning properties works.

How odd is that ?
 
DOM related calls shouldnt take valid tags into account.
Since XML can define its own.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top