table1.rows [0]. Tried to use the console using cells [1]. Inner HTML
=> "number"
also tried this code table1.rows [0]. Sales [1] WinnerHTML! = Null
=> true
But if I try this code below:
HTML:
& lt; Table id = "table1" & gt; & Lt; TR & gt; & Lt; TD & gt; Price & lt; / TD & gt; & Lt; TD & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Price & lt; / TD & gt; & Lt; TD & gt; Price & lt; / TD & gt; & Lt; / TR & gt; & Lt; Table & gt;
Javascript:
for (var i = 0; i & lt; table1.rows.length; i ++) {for (var j = 0; j and lieutenant; table 1. rosh [i]. Seals [j] .arfer html (j ++) {if (table 1. ro [ii] seals [ja] .non html! = Null) { Var count = 0; Calculation = count + 1; Warning (count); }}}
-
table 1
is not Define. You need to usedocument.getElementById
to get a reference of your table element. - On line 2, you
j & lt; Table1.rows [i] .cells [j] .innerHTML
. It does not make any sense and it does not make itj & lt; Table1.rows [i] .cells.length
. - You need to move your
count
variable outside of your loop, otherwise it will always be equal to 1.
Change your code to:
var table1 = document.getElementById ('table1'); Var calculation = 0; (Var i = 0; i & lt; table1.rows.length; i ++) {for (var j = 0; j & lt; Table 1 .rows [i] .cells.length; j ++) {if (Table1.rows [i] cells [j] .winnerHTML! = Null) {count ++; Warning (count); }}
.
Comments
Post a Comment