前提・実現したいこと
javascriptを使用してデータベースの情報をテーブルで表示しています
(innerHTMLを使って表示しています)
動的に作成されたテーブルのマウスオーバー時の行番号を知を知りたい
発生している問題・エラーメッセージ
innerHTMLで表示しているため戻り値がobjectとなってしまいます
該当のソースコード
javascript
tempHtml = "<table id = "Header" , class="type10">" ;
tempHtml = tempHtml + "<thead>" ;
tempHtml = tempHtml + "<tr>" ;
tempHtml = tempHtml + "<th scope="cols">#</th>" ;
tempHtml = tempHtml + "<th scope="cols">A</th>" ;
tempHtml = tempHtml + "<th scope="cols">B</th>" ;
tempHtml = tempHtml + "</tr>" ;
tempHtml = tempHtml + "</thead>" ;
tempHtml = tempHtml + "<tbody>" ;
tempHtml = tempHtml + "<tr>" ;
tempHtml = tempHtml + "<td>" + recordSet(0) + "</td>" ;
tempHtml = tempHtml + "<td>" + recordSet(1) + "</td>" ;
tempHtml = tempHtml + "<td>" + recordSet(2) + "</td>"
tempHtml = tempHtml + "</tr>" ;
tempHtml = tempHtml + "</tbody>" ;
tempHtml = tempHtml + "</table>" ;
document.getElementById("disp").innerHTML = tempHtml;
jquery
$(function(){
$(document).on("mouseover",".type10",function(){ var tbl = document.getElementById("Header"); var idx = tbl.rows.index(); console.log(idx); });
});
試したこと
行番号を知るプロパティが分かりません
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答3件
あなたの回答
tips
プレビュー