动态创建菜单项时,如何将鼠标悬停 javascript 函数添加到 asp.net 菜单项?不允许您添加 .attributes 功能。
[Javasript]
<script type="text/javascript">
function ChangeProjectImage(obj) {
var ctrl = document.getElementById(obj.id);
...code...
}
</script>
[HTML - 菜单控制]
<asp:Menu ID="Menu1" runat="server" Orientation="Vertical" Font-Names="Verdana" Font-Size="12px"
CssClass="Menu">
</asp:Menu>
[CodeBehind - 动态添加菜单项]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.IsPostBack Then
Else
Dim dt As DataTable = Session("dt")
For Each dr As DataRow In dt.Rows
Dim mi As New MenuItem(dr(0), dr(1), "images\folder_03.png")
Menu1.Items.Add(mi)
Next
End If