gpt4 book ai didi

javascript - 如何使 td 标签看起来像 HTML 中的标签?

转载 作者:太空宇宙 更新时间:2023-11-03 20:34:56 25 4
gpt4 key购买 nike

我有一些使用ajax 获取数据的行,如果我使用a 标签,浏览器会刷新并且一些数据会丢失。然后我只使用 td 标签,但我想让它看起来像 a 标签(颜色,光标一只手)cursor a hand

这里是我的代码:

<td style="color: green;" onclick="myFunction(this)">hello</td>
// failed with: <td style="color: green;" onclick="myFunction(this)"><a href="">hello</a></td>

最佳答案

您可以使用以下 css 使 td 看起来像 a

td {
color: #337ab7;
text-decoration: none;
cursor: pointer;
}

td:focus, td:hover {
color: #23527c;
text-decoration: underline;
}

关于javascript - 如何使 td 标签看起来像 HTML 中的标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34851189/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com