这里有一个非常类似的问题Make A List Item Clickable (HTML/CSS),我在寻求帮助,但我无法让它发挥作用。我的网页上有一个看起来像这样的链接
StringBuilder
单击时显示包含无序列表的菜单。
Imports System.IO.Ports
WithEvents MSComm1 As SerialPort
Private Sub MSComm1_DataReceived(ByVal eventSender As System.Object, ByVal eventArgs As SerialDataReceivedEventArgs) Handles MSComm1.DataReceived
Using RxNumeric As New StringBuider
Dim Rx As String = MSComm1.ReadExisting
For i As Int32 = 0 To Rx.Length - 1
SReply(i) = Convert.ToInt32(Rx.Chars(i))
RxNumeric.Append(" " & Convert.ToString(SReply(i), 16))
Next i
txtWindow.Text = RxNumeric.ToString()
End Using
Replied = True
End Sub
现在我想要的是这个li元素是可点击的,就好像它是一个链接,光标变成一只手并在悬停时改变颜色。然后,当点击无序列表中的一个li元素时,我想要函数" myFunction"跑去。
答案 0 :(得分:0)
示例代码:
li.link span {
color: blue;
text-decoration: none;
cursor: pointer;
}
li.link span:hover {
color: #00f;
text-decoration: underline;
}
<ul role="menu">
<li role="presentation" class="link" value="thing" onclick="myFunction()"><span>Text</span></li>
</ul>