Salve a tutti, ho necessità di esportare una tabella in html in un foglio excel. Cercando nel forum ho trovato una funzione che fa esattamente questa operazione.
Ho solo un problema, la funzione recupera il contenuto di ogni cella della tabella, ma nella mia tabella ogni cella contiene un tag input. Come faccio a prendere il valore presente nel tag?
codice:
<html>
<head>
<script type="text/javascript">
function CreateExcelSheet()
{
var x=myTable.rows
var xls = new ActiveXObject("Excel.Application")
xls.visible = true
xls.Workbooks.Add
for (i = 0; i < x.length; i++)
{
var y = x[i].cells
for (j = 0; j < y.length; j++)
{
xls.Cells( i+1, j+1).Value = y[j].innerText
}
}
}
</script>
</head>
<body marginheight="0" marginwidth="0">
esporta tabella in xls
</p>
<table id="myTable" border="0">
<tr> <th>Name</th> <th>Age</th></tr>
<tr> <td><input value="Shivani" /> </td> <td><input value="25" /></td> </tr>
<tr> <td><input value="Naren" /> </td> <td><input value="28" /></td> </tr>
<tr> <td><input value="Logs" /></td> <td><input value="57" /></td> </tr>
<tr> <td><input value="Kas" /></td> <td><input value="54" /></td> </tr>
<tr> <td><input value="Sent" /> </td> <td><input value="26" /></td> </tr>
<tr> <td><input value="Bruce" /> </td> <td><input value="7" /></td> </tr>
</table>
</body>
</html>
</body>
</html>
grazie