当控制器在窗体视图中时,鼠标悬停在mosueout上的javascript无效 [英] javascript on mouse over and on mosueout not working when controles are in formview

查看:64
本文介绍了当控制器在窗体视图中时,鼠标悬停在mosueout上的javascript无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script language="javascript" type="text/javascript">
       function fun1() {

           document.getElementById("chng_profilepic").style.visibility = "visible";
          
       }

       function fun2() {
           document.getElementById("chng_profilepic").style.visibility = "hidden";
          
       }
    
    </script>



及以下是aspx页码


and below is aspx page code

<img src='<%#"uploaded1/"+ Eval("image") %>' alt='<%# Eval("image") %>' id="profile_pic" style="margin-left:4px; width:180px"

height="200" onmouseover="fun1()"  önmouseout="fun2()" />

 <asp:Button ID="chng_profilepic" runat="server" Text="change profile" OnClick="chng_profilepic_Click" />



此内容在页面上,附在母版页上,鼠标悬停在onmouseout上无法正常工作,如何操作?

图像和按钮都在窗体视图中


this content is on page which is attached with master page and on mouse over and onmouseout is not working so how to do it?
Both Image and button is inside a formview

推荐答案

试试这个

try this
<script language="javascript" type="text/javascript">
       function fun1() {
 
           document.getElementById('<%=chng_profilepic.ClientID%>').style.visibility = "visible";
          
       }
 
       function fun2() {
           document.getElementById('<%=chng_profilepic.ClientID%>').style.visibility = "hidden";
          
       }
    
    </script>




直接访问gridview或repeater中的元素非常困难,请尝试使用jQuery而不是css属性
Hi,
Accessing Elements inside gridview or repeater directlyis quite difficult, try jQuery instead by its css property
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
   <script language="javascript" type="text/javascript">
       function fun1() {


' 。MyButton')。css( display block);
}
功能 fun2(){
('.MyButton').css("display", "block"); } function fun2() {


这篇关于当控制器在窗体视图中时,鼠标悬停在mosueout上的javascript无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆