Hallo Karlheinz
auf dem Xampp web folgender Code.
Bei mir im web unterverzeichnis javascript die Datei ips_js.php
Bedingung ist das das Verzeichnis Dojo hieher kopiert wird. Die dojo.js liegt dann im verzeicnis dojo/dojo/dojo.js
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta name="author" content="hgp">
<meta name="editor" content="html-editor phase 5">
<script type="text/javascript" src="../dojo/dojo/dojo.js" djConfig=""></script>
<script language="JavaScript">
var WriteValueToIPS = function (url) { dojo.xhrGet({ url: url, timeout:5000 }) };
var ReadValueFromIPS = function (node, url) { dojo.addOnLoad( function () { var req = function () { dojo.xhrGet( { url: url, node: dojo.byId(node), load: function (data, xhr) { if (xhr.args.node) { xhr.args.node.innerHTML = data; } } } ); }; req(); }); };
var refreshPeriodically = function (node, url, interval) { dojo.addOnLoad( function () { var req = function () { dojo.xhrGet( { url: url, node: dojo.byId(node), load: function (data, xhr) { if (xhr.args.node) { xhr.args.node.innerHTML = data; } } } ); }; req(); window.setInterval(req, interval); }); };
refreshPeriodically("A_Temperatur", "http://192.168.135.153/dojo/getIPSValue.php?id=51408&dez=1", 2000);
refreshPeriodically("A_Temperatur_S", "http://192.168.138.36/dojo/getIPSValue.php?id=34359&dez=1", 1900);
refreshPeriodically("BeleuchtungA", "http://192.168.135.153/dojo/getIPSValue.php?id=53293&style=grafik&file0=Laus.png&file1=Lan.png",2000);
//netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
</script>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">
<!--Lampen und deren Schalter----->
<div id="BeleuchtungA" style="left: 155px; top: 135px; position: absolute"
onmousedown="ReadValueFromIPS('BeleuchtungA', 'http://192.168.135.153/dojo/FS20_IPS_Grafikschalter.php?id=48610&status=53293&file0=Laus.png&file1=Lan.png');">
</div>
<div title='Temperatur Aussen' style='position:absolute;left:365px;top:15px;font-size:15px;'>
<span id="A_Temperatur">T</span>°C
</div>
<div title='Temperatur Aussen' style='position:absolute;left:465px;top:15px;font-size:15px;'>
<span id="A_Temperatur_S">T</span>°C
</div>
<div style='position:absolute;left:570px;top:300px;'>
<form method='post' action='<?php echo $_SERVER['PHP_SELF'] ?>'>
<input type='image' src='../Bilder/aktualisieren.png' alt="aktuaslisieren">
</form>
</div>
</body>
</html>
auf dem IPS web sollte folgendes Script im Verzeichnis Dojo datei getIPSValue.php sein.
<?php
header("Expires: Mon, 12 Jul 1995 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s", time())." GMT");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: pre-check=0, post-check=0, max-age=0");
$t="Erg:";
if (isset($_GET['id']) == true) $t=$t." ID:".$_GET['id'];
if (isset($_GET['dez']) == true) $t=$t." dez:".$_GET['dez'];
if (isset($_GET['style']) == true) $t=$t." style:".$_GET['style'];
setvalue(32846,$t);
if (isset($_GET['id']) == true) {
if (isset($_GET['dez']) == true) {
$styletext = number_format(GetValue((int)$_GET['id']), $_GET['dez'], ",", "");
}else{
$styletext = GetValue((int)$_GET['id']);
}
if (isset($_GET['style']) == true) {
switch($_GET['style']) {
case 'grafik':
if (GetValue((int)$_GET['id']) == 1) {
if (isset($_GET['hoehe']) == true) {
$styletext = "<input type='image' src='" . $_GET['file1'] ."' height='" . $_GET['hoehe'] ."' width='" . $_GET['breite'] ."' >";
} else {
$styletext = "<input type='image' src=" . $_GET['file1'] ." >";
}
} else {
if (isset($_GET['hoehe']) == true) {
$styletext = "<input type='image' src='" . $_GET['file0'] ."' height='" . $_GET['hoehe'] ."' width='" . $_GET['breite'] ."' >";
} else {
$styletext = "<input type='image' src=" . $_GET['file0'] ." >";
}
}
break;
default:
break;
}
}
echo $styletext;
}
?>
und das script FS20_IPS_Grafikschalter.php
<?php
header("Expires: Mon, 12 Jul 1995 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s", time())." GMT");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: pre-check=0, post-check=0, max-age=0");
$t="Erg:";
if (isset($_GET['id']) == true) $t=$t." ID:".$_GET['id'];
if (isset($_GET['status']) == true) $t=$t." status:".$_GET['status'];
setvalue(52725,$t);
if (isset($_GET['id']) == true) {
FS20_SwitchMode((int)$_GET['id'],!GetValueBoolean((int)$_GET['status']));
if (GetValue((int)$_GET['status']) == 1) {
if (isset($_GET['hoehe']) == true) {
$styletext = "<input type='image' src='" . $_GET['file1'] ."' height='" . $_GET['hoehe'] ."' width='" . $_GET['breite'] ."' >";
} else {
$styletext = "<input type='image' src=" . $_GET['file1'] ." >";
}
} else {
if (isset($_GET['hoehe']) == true) {
$styletext = "<input type='image' src='" . $_GET['file0'] ."' height='" . $_GET['hoehe'] ."' width='" . $_GET['breite'] ."' >";
} else {
$styletext = "<input type='image' src=" . $_GET['file0'] ." >";
}
}
}
echo $styletext;
?>
Natürlich solltest du nun die ID’s ändern
beim FS20_IPS_Grafikschalter.php id(Instanz) und status(Staus der Instanz)
Achung: Firefox blockt den Zugriff, nicht verwenden.Ich suche noch nach einer lösung.
eventuell //netscape.security.PrivilegeManager.enablePrivilege(„UniversalBrowserRead“);
IE fragt um Erlaubnis, die läst sich deaktiviern.
[Extras] [Internetoptionen] [Sicherheit] [Lokales Intranet] [Stufe anpassen] [Auf Datenquellen über Domänengrenzen hinweg zugreifen] [Aktivieren]