简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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