Habe folgenden Java Code:
function loadXMLDoc() {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", "my_data3.xml", true);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", "my_data3.xml", true);
req.send();
}
}
}
// handle onreadystatechange event of req object
function processReqChange() {
// only if req shows "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
createTable();
} else {
alert("There was a problem retrieving the XML data:n" +
req.statusText);
}
}
}
function createTable()
{
==> Fehlermeldung
document.getElementById('Lamp').innerHTML = req.responseXML.getElementsByTagName('Lamp')[0].childNodes[0].nodeValue;
document.getElementById('PrName').innerHTML= req.responseXML.getElementsByTagName('Name')[0].childNodes[0].nodeValue;//s.substr(0, 10);
document.getElementById('Error').innerHTML=req.responseXML.getElementsByTagName('Error')[0].childNodes[0].nodeValue;
Projektor = new Image();
Input = new Image();
Mute = new Image();
if (req.responseXML.getElementsByTagName('Power')[0].childNodes[0].nodeValue==0)
{
Projektor.src = "projector_off.PNG";
}
else
{
Projektor.src = "projector_on.PNG";
}
if (req.responseXML.getElementsByTagName('Input')[0].childNodes[0].nodeValue==0)
{
Input.src = "button_vid.JPG";
}
else
{
Input.src = "button_vga.JPG";
}
if (req.responseXML.getElementsByTagName('Mute')[0].childNodes[0].nodeValue==0)
{
Mute.src = "button_off.JPG";
}
else
{
Mute.src = "button_on.JPG";
}
if (req.responseXML.getElementsByTagName('Dieb')[0].childNodes[0].nodeValue==0)
{
document.getElementById("projector1").style.backgroundColor="#FFFFFF";
}
else if (req.responseXML.getElementsByTagName('Dieb')[0].childNodes[0].nodeValue==1)
{
document.getElementById("projector1").style.backgroundColor="#FF8000";
}
else
{
document.getElementById("projector1").style.backgroundColor="#800000";
}
document.getElementById("prostatus").src=Projektor.src;
document.getElementById("inputstatus").src= Input.src;
document.getElementById("mutestatus").src= Mute.src;
setInterval ("loadXMLDoc()", 200);
}
Und diesen HTML:
<body onload="loadXMLDoc();">
<div style="width: 320px; height: 356px">
<h2><span id="PrName"></span></h2>
<table>
<tr>
<th style="width:150px" colspan="2">Powerstatus</th>
</tr>
<tr>
<td id="projector1" colspan="2">
<form action="" method="post">
<input type="hidden" name="<?z varname ($output[0]) ?>"
<?z if ($output[0] == 0) { ?>value="1"<?z } ?>
<?z if ($output[0] != 0) { ?>value="0"<?z } ?>
/>
<input type="image" SRC="projector_off.PNG" id="prostatus" />
</form>
</td>
</tr>
<tr>
<th style="width:150px">Picture-Muting</th>
<th style="width:150px">Eingangswahl</th>
</tr>
<tr>
<td id="projector2">
<form action="" method="post">
<input type="hidden" name="<?z varname ($output[2]) ?>"
<?z if ($output[2] == 0) { ?>value="1"<?z } ?>
<?z if ($output[2] != 0) { ?>value="0"<?z } ?>
/>
<input type="image" SRC="button_off.JPG" id="mutestatus" width="150"/>
</form>
</td>
<td id="projector3">
<form action="" method="post">
<input type="hidden" name="<?z varname ($output[1]) ?>"
<?z if ($output[1] == 0) { ?>value="1"<?z } ?>
<?z if ($output[1] != 0) { ?>value="0"<?z } ?>
/>
<input type="image" SRC="button_vid.JPG" id="inputstatus" width="150"/>
</form>
</td>
</tr>
<tr>
<th style="width:150px">Lampenzeit</th>
<th style="width:150px">Fehlermeldung</th>
</tr>
<tr>
<td id="projector4"><span id="Lamp"></span><a>h</a></td>
<td id="projector5"><span id="Error"></span></td>
</tr>
</table>
</body>
</div>
</html>
Folgende Problematik tritt nun auf:
Wenn ich die Seite am IPhone lade bekomme ich einen Fehlermeldung:
TypeError: Result of expression is not an object ==> Fehlermeldung
Wenn ich nun die Taste mit der (id="prostatus") drücke, wird alles korrekt angezeigt, und die Fehlermeldung verschwindet.
Kann mir jemand sagen woran dis liegt?
Danke im voraus