简体   繁体   English

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

[英]Hyperlink for Grid View cells in javascript

"How can I do hyperlink in JavaScript function for Grid view cell to point another function in the same script. “如何在Grid View单元的JavaScript函数中做超链接,以指向同一脚本中的另一个函数。
currently I'm trying to do this: 目前,我正在尝试这样做:

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)");
    }
}

It is not giving me proper output in page. 它没有在页面中给我适当的输出。

try this : 尝试这个 :

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM