开发者

Javascript Uncaught ReferenceError: parameter is not defined

开发者 https://www.devze.com 2023-03-13 12:57 出处:网络
I have some Javascript code: function addRow(tableID, rowId) { var table = document.getElementById(tableID);

I have some Javascript code:

function addRow(tableID, rowId) {
var table = document.getElementById(tableID);
var rowPosition = document.getElementById(rowID).rowIndex;
//etc.
}

But this throws a Javascript error

"Uncaught ReferenceError: rowID is not defined"

Though looking on Firebug, I can see that the functions receives a corr开发者_如何学Pythonect row identifier, but once the code reaches the second line inside the function the parameter rowID seems unknown.

Can anyone help?


JavaScript is case-sensitive. You've used rowId as the argument name (small "d") while inside the function you have rowID (capital "D"). Change the argument to rowID to fix the issue.


You're passing the parameter rowId, but referencing it rowID. Variable names are case sensitive, they both need to be the same.

0

精彩评论

暂无评论...
验证码 换一张
取 消