I have a python file which contains tables (coded in html). I wish to click on the cells of the table and (using the onclick feature of html) output the table value directly onto a textbox. I am able to do this in an html file but am struggling to incorporate the same model into a python file. The (working) code to copy the values of cells of a table to an alertbox is below:
http://jsfiddle.net/8A37s/5/ JavaScript:
var table = document.getElementById("tableID");
if (table != null) {
for (var i = 0; i < table.rows.length; i++) {
for (var j = 0; j < table.rows[i].cells.length; j++)
table.rows[i].cells[j].onclick = function () {
tableText(this);
};
}
}
function tableText(tableCell) {
alert(tableCell.innerHTML);
}
To incorporate html into this python file, I've used the following procedure (successfully):
print """<table>"""
Is the process for implementing javascript the same?