[英]How to call a function inside javascript when clicking a link button inside a table generated by callback event
function ReceiveServerData(retValue) {
var val = retValue.split('#')
var ch1= val[1].split(',');
if (val[0] == 1) {
var tab = "";
//codes
var row = ch1.split("¥");
for (n = 0; n <= row.length - 1; n++) {
var col = row[n].split("µ");
tab += "<td style='width:5%;text-align:left'><a href onclick ='Documents(" + col[0] + "," + i + ")' style='text-align:left;'>Download Attachment </td>";
//codes
}
}
function Documents(ID,i) {
//codes
}
it doesn't seem to work correctly though. 它似乎无法正常工作。 Is there a better way to do this?
有一个更好的方法吗?
change this: 改变这个:
tab += "<td style='width:5%;text-align:left'><a href onclick ='Documents(" + col[0] + "," + i + ")' style='text-align:left;'>Download Attachment </td>";
to this: 对此:
tab += "<td style='width:5%;text-align:left'><a href='#' onclick='Documents(" + col[0] + "," + i + ")' style='text-align:left;'>Download Attachment </td>";
tips: 1. You should give a "#" to href else it will go refresh your page. 提示:1.您应该给href加上“#”,否则它将刷新您的页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.