Rockwell-automation 1768-EWEB EtherNet/IP Web Server Module User Manua Uživatelský manuál Strana 101

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 170
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 100
Publication ENET-UM527E-EN-P - October 2006
Create Custom Web Pages 101
These functions are contained in the XMLObjectLoaderLib.js library.
For example, the following code is a snippet from a web page which
displays information about the identity object of a device in slot 1 of
the local chassis.
<script type="text/javascript" src="/scripts/conversion.js"></script>
<script type="text/javascript" src="/scripts/XMLObjectLoaderLib.js"></script>
<script type="text/javascript" language="javascript"> var idobj;
function loadPage() {
document.getElementById("vendor").innerText = "" + idobj.VendorID;
document.getElementById("type").innerText = "" + idobj.DeviceType;
document.getElementById("code").innerText = "" + idobj.ProductCode;
document.getElementById("rev").innerText = idobj.Revision.MajorRevision + "."
+
idobj.Revision.MinorRevision;
document.getElementById("status").innerText = "0x" + decToHex(idobj.Status);
document.getElementById("serial").innerText = "0x" +
decToHex(idobj.SerialNumber);
document.getElementById("prodname").innerText = idobj.ProductName;
}
function loadme() {
var id = "<% CIPMessage("1,1", 1, 1, 1, 0, 0,"0","STRING"); %>"
var xl = new XMLObjectLoader();
xl.LoadObject("idobj", "/CIPXMLobj/CN_01_Identity.xml", id);
loadPage();
</script>
<body onload="loadme();" ...>
Function Description
XMLObjectLoader() This routine initializes the XMLObjectLoader object used to parse the CIP return
data. Set it to a declared variable in the Javascript. For example:
var xol = new XMLObjectLoader();
LoadObject(objectname,
xmlfilename, objectstruct)
The LoadObject function is a member function of the XMLObjectLoader object that
parses the CIP object return string passed in objectstruct, using the XML description file
xmlfilename, and placing the result in the objectname variable, where:
objectnameglobal variable that contains the result, accessible to all scripts within
the page.
xmlfilenameabsolute or relative path to the XML file containing the object description
objectstruct CIP object return string
Zobrazit stránku 100
1 2 ... 96 97 98 99 100 101 102 103 104 105 106 ... 169 170

Komentáře k této Příručce

Žádné komentáře