Hi
I must write a custom webpage, from wich a user can save a csv file that contains the controller tags and their values. I use a 1768-eweb module and a Compactlogix L43. I found this code on the Internet (there is a table with casual data an it would create a csv file with these data)
<html>
<head>
<script type="text/javascript">
function WriteCSVFile()
{
var x = myTable.rows
var ForWriting = 2
var ForAppending = 8
var TriStateFalse = 0
var fsObj = new ActiveXObject("Scripting.FileSystemObject")
var newFile = fsObj.OpenTextFile("/user/web/ClientSideJScriptFile.csv", ForWriting, true, TriStateFalse)
for (i = 0; i < x.length; i++)
{
var y = x.cells
var strTmp = y[0].innerText
if (y.length > 0)
{
for (j = 1; j < y.length; j++)
{
strTmp = strTmp + "," + y[j].innerText
}
}
newFile.WriteLine(strTmp)
}
newFile.Close()
}
</script>
</head>
<body lang=EN-US background="back.gif" link=blue vlink=purple>
<form>
<input type="button" onclick="WriteCSVFile()" value="Create CSV File">
</form>
<%
Put any table here, your little ol heart desireth
If you change the id, you gotta change it in the script
%>
<table id="myTable" border="1">
<tr> <td>Abe </td> <td>23</td> </tr>
<tr> <td>Betty </td> <td>34</td> </tr>
<tr> <td>Carol </td> <td>56</td> </tr>
<tr> <td>David </td> <td>24</td> </tr>
<tr> <td>Edward</td> <td>16</td> </tr>
<tr> <td>Floyd </td> <td>19</td> </tr>
<tr> <td>Gary </td> <td>38</td> </tr>
<tr> <td>Harold</td> <td>28</td> </tr>
</table>
</body>
</html>
I downloaded the page on the module,but it doesn't work (the page loads correctly but an error occurs when I click on the button: the ActiveX object can't be created. What can I do?
I must write a custom webpage, from wich a user can save a csv file that contains the controller tags and their values. I use a 1768-eweb module and a Compactlogix L43. I found this code on the Internet (there is a table with casual data an it would create a csv file with these data)
<html>
<head>
<script type="text/javascript">
function WriteCSVFile()
{
var x = myTable.rows
var ForWriting = 2
var ForAppending = 8
var TriStateFalse = 0
var fsObj = new ActiveXObject("Scripting.FileSystemObject")
var newFile = fsObj.OpenTextFile("/user/web/ClientSideJScriptFile.csv", ForWriting, true, TriStateFalse)
for (i = 0; i < x.length; i++)
{
var y = x.cells
var strTmp = y[0].innerText
if (y.length > 0)
{
for (j = 1; j < y.length; j++)
{
strTmp = strTmp + "," + y[j].innerText
}
}
newFile.WriteLine(strTmp)
}
newFile.Close()
}
</script>
</head>
<body lang=EN-US background="back.gif" link=blue vlink=purple>
<form>
<input type="button" onclick="WriteCSVFile()" value="Create CSV File">
</form>
<%
Put any table here, your little ol heart desireth
If you change the id, you gotta change it in the script
%>
<table id="myTable" border="1">
<tr> <td>Abe </td> <td>23</td> </tr>
<tr> <td>Betty </td> <td>34</td> </tr>
<tr> <td>Carol </td> <td>56</td> </tr>
<tr> <td>David </td> <td>24</td> </tr>
<tr> <td>Edward</td> <td>16</td> </tr>
<tr> <td>Floyd </td> <td>19</td> </tr>
<tr> <td>Gary </td> <td>38</td> </tr>
<tr> <td>Harold</td> <td>28</td> </tr>
</table>
</body>
</html>
I downloaded the page on the module,but it doesn't work (the page loads correctly but an error occurs when I click on the button: the ActiveX object can't be created. What can I do?
Last edited: