|
Please use our Code Center to obtain source-code and example projects/solutions:
http://codecenter.softwaretoolbox.com
|
|
|

|
|
|
|
|

|
|
 Web Based Applications using the OPC Web Client Web Service
Objective
To write values to a Tag array from a webpage.
This example assumes that you have the Software Toolbox TOPServer installed, and the default project "simdemo.opf"
is loaded within the TOPServer.
Source code
JAVASCRIPT
<html> <head> <title>OPC Web Client running in IE, using OPC Web Client WEB SERVICE</title>
<SCRIPT LANGUAGE="JScript" src="ArgumentFormat.js"></SCRIPT> <script language="javascript">
function fnInit() {
provider.init(); }
function fnWriteResult() { if(event.error) { alert('error' + event.errorMessage); }
else { alert('Write success!'); } }
function btnWrite_click() {
var arrValues = document.all.tagvalue.value.split(","); provider.write({ServerClass: "SWToolbox.TOPServer", ItemID: "Channel_1.Device_1.TagArray_1", Value: arrValues});
}
</script> </head>
<body onload="fnInit();"> <DIV id="service" style="behavior:url(webservice.htc)"></DIV>
<DIV id="provider" style="behavior:url(eagateway.htc)" webService="service" onWriteResult="fnWriteResult()"></DIV>
<p>OPC Server: SWToolbox.TOPServer -with modified "simdemo.opf" project loaded.<br> <b>Tag Values to write:</b>
<input type="text" name="tagvalue" value="1, 2, 3, 4, 5, 6, 7, 8, 9, 10" size="25" readonly="readonly">
<input type="button" name="b1" value="write" onClick="btnWrite_click();"> </p> </body>
</html>
|
|

|
|
|
|

|
|
|