我使用的node.js所以一些操作后,我用的是代码:脚本不执行
res.sendFile(path.join(__dirname+'\\showPlayers.html'));
显示此HTML页面。该showPlayers.html的代码是:
<html>
<body>
<table id="giocatori">
<thead>
<tr>
<th>Giocatore</th>
<th>Ruolo</th>
<th>Costo</th>
<th>Squadra</th>
<th>Operazione</th>
</tr>
</thead>
</table>
</body>
<script type="text/javascript">
console.log("BAU");
var table = document.getElementById("giocatori");
for(var i=0;i<2; i++){
var row = table.insertRow(i);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3=row.insertCell(2);
var cell4=row.insertCell(3);
var cell5=row.insertCell(4);
cell1.innerHTML = "Mario";
cell2.innerHTML = "DIF";
cell3.innerHTML = "10";
cell4.innerHTML = "Juve";
cell5.innerHTML = '<form method="post" action="/giocatore"> <input type="submit" name="a" value="Acquista" /> <input type="submit" name="b" value="Cancella" /> </form>';
}
</script>
</html>
在脚本中有一个“console.log
”和Node.js的程序时,我重定向到这个页面我只看到THEAD的表,没有从控制台无输出。如果我点击“showPlayers.html”,我运行的页面显示正确。任何人都可以帮助我?
你'''标签之前''