我使用的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」,我運行的頁面顯示正確。任何人都可以幫助我?
你'''標籤之前''