-3
如果我有一個名爲「post」的標籤,並且href =「perl中的東西」,我應該使用javascript來使其可點擊並且將我重定向到鏈接?如何使表中的每個TR標籤都與Perl和Javascript鏈接
如果我有一個名爲「post」的標籤,並且href =「perl中的東西」,我應該使用javascript來使其可點擊並且將我重定向到鏈接?如何使表中的每個TR標籤都與Perl和Javascript鏈接
如果實現的jQuery,你可以做這樣的事情:
jQuery(document).ready(function($) {
$(".click").click(function() {
window.document.location = $(this).attr("href");
});
});
編輯
假設你的標籤看起來像這樣
<tr class = "click" href = "<%= something from Perl %>">
完美,感謝 – user3752957
碼味 - 使用' this.href'而不是'$(this).attr('href')' – Alnitak