为什么可以't我使用在另一个地方使用Javascript使用的相同代码更新此表
Why can't I update this table with the same code used in another place using Javascript?
表格单元格在changeScore函数中正确更新为"(空),但当我尝试将新分数放入editUpdate函数时,该单元格在其中根本不会更改。它只是空着。有什么想法吗?
function changeScore(playerKey)
{
var table = document.getElementById("scoreTable");
players[playerKey].score = players[playerKey].oldScore;
table.rows[currentRound - 1].cells[playerKey + 1].innerHTM = '';
document.getElementById('inputArea').innerHTML = '<font size="6">Did <b>' + players[playerKey].name + '</b> take <b>' + players[playerKey].bid + '</b> trick(s)?</font><br /><button value="Yes" id="yesButton" onclick="editUpdate(' + playerKey + ', ''yes'')">Yes</button>    <button value="No" id="noButton" onclick="editUpdate(' + playerKey + ', ''no'')">No</button>';
}
function editUpdate(thePlayerKey, answer)
{
var table = document.getElementById("scoreTable");
players[thePlayerKey].oldScore = players[thePlayerKey].score;
if (answer == "yes"){
**
}else{
**
}
table.rows[currentRound - 1].cells[thePlayerKey + 1].innerHTM = '<font color="' + players[thePlayerKey].font + '">' + players[thePlayerKey].score + '</font>';
document.getElementById('inputArea').innerHTML = '<button onclick="startRound()">Start Round</button>     <button onclick="edit()">Edit Scores</button>';
}
innerHTM
应为innerHTML
此:
table.rows[currentRound - 1].cells[playerKey + 1].innerHTM = '';
应为:
table.rows[currentRound - 1].cells[playerKey + 1].innerHTML = '';
(与第二个函数相同)
相关文章:
- 如何在javascript上使用flak-babel进行翻译
- 在javascript中使用命名空间
- 操作员”;新的“;根据我想在几个JavaScript文件中使用的类,在JavaScript中使用
- 在JavaScript中使用对象作为属性键
- 为什么不'我们在javascript中使用函数参数的数据类型
- 在终端中运行 JavaScript 时(使用 rhino),如何使用 print() 函数在一行中打印
- 如何通过安全的https连接在javascript中使用基于soap xml的Web服务
- 如何在javascript中使用不止一个函数
- 在 Jquery/Javascript 中使用多个 OR (||) 运算符时如何设置变量
- 当null应该在javascript中使用而不是未定义时
- Javascript 变量使用 jquery 查找变量
- 避免在if condition-Javascript中使用函数
- 在javascript中使用split函数希望在页面加载时拆分url
- 在Javascript中使用全局变量作为缓存是很好的
- 在javascript中使用方括号表示法的嵌套对象
- 如何在javascript中使用嵌套函数作为生成器(使用“inner”yields)
- 如何分割由JavaScript中使用正则表达式的多个部分组成的字符串
- 在javascript中使用json数据导致问题
- 在javascript中使用小数
- 选中复选框的Jquery/Javascript问题使用输入框操作将行从一个表添加到另一个表