Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript中网格视图单元格的超链接_Javascript_Html - Fatal编程技术网

javascript中网格视图单元格的超链接

javascript中网格视图单元格的超链接,javascript,html,Javascript,Html,“如何在JavaScript函数中为网格视图单元格创建超链接,以指向同一脚本中的另一个函数。 目前我正在尝试这样做: var gri = document.getElementById('<%= GridView2.ClientID %>'); var rows = gri.getElementsByTagName('tr'); for (var j = 0; j < rows.length; ++j) { var cells = rows[j].getElementB

“如何在JavaScript函数中为网格视图单元格创建超链接,以指向同一脚本中的另一个函数。
目前我正在尝试这样做:

var gri = document.getElementById('<%= GridView2.ClientID %>');
var rows = gri.getElementsByTagName('tr');
for (var j = 0; j < rows.length; ++j) {
    var cells = rows[j].getElementByTagName("td"); 
    if (cells.length > 0) {
        cells[0].innerText = serviceWindowdate.link("divcolapse(date)");
    }
}
var gri=document.getElementById(“”);
var rows=gri.getElementsByTagName('tr');
对于(变量j=0;j0){
单元格[0]。innerText=serviceWindowdate.link(“divcolapse(日期)”;
}
}
页面中的输出不正确。

请尝试以下操作:

if (cells.length > 0) {
    cells[0].innerHtml = "<a href='javascript://yourFunction();'>Link text</a>";
}
if(cells.length>0){
单元格[0]。innerHtml=“”;
}

serviceWindowdate.link(“divcolapse(日期)”)
?那是什么?serviceWindowdate是变量,我需要在网格视图中显示该变量的值。这不起作用,它读取锚定标记,同时显示输出。无论如何,感谢您的建议。需要将“innerHtml”更改为“innerHtml”区分大小写。现在可以正常工作了,谢谢Akbari