I just started working with Javascript and I ran into an error with Visual Studio stating, "Validation (ASP.Net): Attribute 'onMouseOver' is not a valid attribute of element 'Button'". Basically, I entered onMouseOver="this.style.color='Red'" within the HTML code of a button control. When I run my web project, the mouse over command works just fine; however, the error message is posted.
我刚刚开始使用Javascript,我遇到了一个错误,Visual Studio声称,“验证(ASP.Net):属性'onMouseOver'不是元素'Button'的有效属性”。基本上,我在按钮控件的HTML代码中输入了onMouseOver =“this.style.color ='Red'”。当我运行我的web项目时,鼠标悬停命令工作得很好;但是,错误消息已发布。
What should I do to resolve this error or is this error message not critical, since the mouse over command works well?
我该怎么做才能解决这个错误,或者这个错误信息并不重要,因为鼠标悬停命令效果很好?
Thank you,
DFM
1 个解决方案
#1
Visual Studio does not like javascript within <asp:..>
server control tags. Their preferred approach is to wire up the javascript in code-behind, for example by using ClientScript.RegisterStartupScript
. Here's an MSDN article explaining their official approach.
Visual Studio不喜欢 <..>
#1
Visual Studio does not like javascript within <asp:..>
server control tags. Their preferred approach is to wire up the javascript in code-behind, for example by using ClientScript.RegisterStartupScript
. Here's an MSDN article explaining their official approach.
Visual Studio不喜欢 <..>