MOUSE OVER事件在asp.net c# [英] MOUSE OVER event in asp.net c#
本文介绍了MOUSE OVER事件在asp.net c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为label 4的标签我想在我的c#中写一个MouseOver事件,这是一个Web应用程序。
protected void Label4_MouseOver( object sender,EventArgs e)
{
Label4.Visible = false ;
}
这是我的代码不能正常工作请告诉我问题
解决方案
In web,你应该使用客户端活动。
尝试:
Label4.Attributes.Add(< span class =code-string> onmouseover, SomeJavaScriptFunction(););
此行将向鼠标悬停标签添加客户端事件。您可以使用此方法在鼠标上编写逻辑。
试试这个:
.aspx文件:
< 脚本 < span class =code-attribute> type = Javascript >
function visible()
{
document .getElementById( Label4)。visible = 假跨度>;
}
< / 脚本 >
< asp:label id = Label1 runat = server text = Hiiii Prashant onmouseover = visible() ; > < / asp:label >
< asp:label id = Label4 runat = server text = Hiiii Prashant > < / asp:label >
http://www.dreamincode.net/forums/topic/132993-mouse-over-event/ [ ^ ]
http://channel9.msdn.com/Forums/TechOff/98215-Mouse-Over-in-ASPNEt [ ^ ]
I have an label named label 4 I want to write an MouseOver event in my c# which is an web application.
protected void Label4_MouseOver(object sender, EventArgs e)
{
Label4.Visible = false;
}
Here is my code its not working please say me the problem
解决方案
In web, you should use client side event.
Try:
Label4.Attributes.Add("onmouseover","SomeJavaScriptFunction();");
This line would add a client side event to mouse over of the label. You can write your logic on mouse over in this method.
Try this:
.aspx file:
<Script type="Javascript"> function visible() { document.getElementById("Label4").visible = false; } </script> <asp:label id="Label1" runat="server" text="Hiiii Prashant" onmouseover="visible();"></asp:label> <asp:label id="Label4" runat="server" text="Hiiii Prashant"></asp:label>
http://www.dreamincode.net/forums/topic/132993-mouse-over-event/[^]
http://channel9.msdn.com/Forums/TechOff/98215-Mouse-Over-in-ASPNEt[^]
这篇关于MOUSE OVER事件在asp.net c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文