1/29/2012 9:20 PM | |
Posts: 20 Rating:
|
How to do a switch (two positions button) on a web page? |
Last edited by: polonez at: 1/29/2012 9:23 PMsomeone have any propositions |
|
1/30/2012 7:49 PM | |
Joined: 2/16/2011 Last visit: 1/13/2025 Posts: 229 Rating:
|
Hello; See manual link..(Chap.13 Web Server) Link to doc:s71200_system_manual_en-US_en-US v2.pdfRegrds
|
Gabriel de Oliveira |
|
3/16/2012 4:50 PM | |
Posts: 10 Rating:
|
To do that you need to add some javascript you your webpage. If you have your tags loaded into an .xml file you can use javascript on your page to compare the value of the string (in the case of a boolean it will be "0" or "1") and change the state of a page element as required. http://www.w3schools.com/js/default.asp will show you exactly what you need to do it. A small sample of code is below that changes the background colour of a <div> element (which can then be used as your indicator). [code]function loadIndicators() { var xmlhttp; var offcolour = "#DDDDFF"; var oncolour = "#3333FF"; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { xmlDoc=xmlhttp.responseXML; if (xmlDoc.getElementsByTagName("DQ0a")[0].childNodes[0].nodeValue=="1") { document.getElementById("DQ0a").style.backgroundColor = oncolour; } else { document.getElementById("DQ0a").style.backgroundColor = offcolour; } setTimeout('loadIndicators()',1000); } } xmlhttp.open("GET","indicators.xml?t=" + Math.random(),true); xmlhttp.send(); }[/code] In the html body you need <div id="DQ0a"></div> somewhere to be changed. You also need the indicators.xml file which will contain elements in this format: <Web_Access> <DQ0a>:="Web_Access".DQ0a:</DQ0a> <DQ0a>:="Web_Access".DQ0a:</DQ1a> ...and so on... <Web_Access> There are several other topics in this forum on Javascript and xml, this script was based on the one from here Hope that helps, I was clueless on this a day ago myself... Jon |
Last edited by: jon_hill988 at: 3/16/2012 4:52 PM |
|
Follow us on