大家好,我想让 td 中的 div 充当 href 的 Angular 色。我怎样才能实现这个目标?
如果不使用 html,也许可以使用 jquery 或 javascript?
<table class="mgmtview_table" align="center">
<tr>
<td class="content" id="content">
<table class="content_table">
<tr>
<td class="topBar">
<div id="div_view" align="center">FusionCharts will load here!</div>
</td>
<td class="topBar">
<div id="div_view2" align="center">FusionCharts will load here!</div>
</td>
<td class="topBar">
<div id="div_view3" align="center">FusionCharts will load here!</div>
</td>
</tr>
<tr>
<td class="topBar">
<div id="div_view4" align="center">FusionCharts will load here!</div>
</td>
<td class="topBar">
<div id="div_view5" align="center">FusionCharts will load here!</div>
</td>
<td class="topBar">
<div id="div_view6" align="center">FusionCharts will load here!</div>
</td>
</tr>
<tr>
<td class="topBar">
<div id="div_view7" align="center">FusionCharts will load here!</div>
</td>
<td class="topBar">
<div id="div_view8" align="center">FusionCharts will load here!</div>
</td>
<td class="topBar">
<div id="div_view9" align="center">FusionCharts will load here!</div>
</td>
</tr>
最佳答案
使用jquery你可以做这样的事情:
$('table.content_table td div').click(function(){
alert('clicked');
location.href='http://google.com';
});
但是如果你想要链接,那么你真的应该使用 <a href="...">
。这就是它们的用途。 :p
关于javascript - TD a href 内的 HTML DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12201004/