I am using <asp:Menu>
control in my web site and populated it from my Sql Server database table using XML data source.
Now i want to add a client side event on menu item click.
When a user clicks any menu item i need to show a please wait dialog window until the page got complete refreshed.
For that i need to run my java script function on client click.
So can any one tell me how to add a client side click event on menu item click.
3512 次
1 に答える
3
cssクラスを追加することで問題は解決します
<DynamicMenuStyle CssClass="primaryDynamicMenu" />
<StaticMenuStyle CssClass="primaryStaticMenu"/>
次に、メインメニュー項目に次の jquery 関数を追加します。
$(function() {
$(".primaryStaticMenu a").each(function(index) {
$(this).click(function() {
alert($(this).attr("href"));
});
});
});
サブメニュー項目の場合:
$(function() {
$(".primaryDynamicMenu a").each(function(index) {
$(this).click(function() {
alert($(this).attr("href"));
});
});
});
于 2013-03-04T15:05:12.057 に答える