当前位置:编程学习 > C#/ASP.NET >>

onmouseover问题

<asp:TableCell HorizontalAlign="Right" >
<asp:Image ID="Image1" ImageUrl="~/images/PageNavi/pagenavi_l.png" runat="server" />
<asp:ImageButton ID="PageNavi_first" ImageUrl="~/images/PageNavi/pagenavi_top_normal.png"
onmouseover="mouse_over(id)" onmouseout="mouse_out(id)" runat="server" />

onmouseover事件应该写到哪啊,写到这里边报错。 --------------------编程问答-------------------- 顶上......我也遇到这个问题 哈哈 

好像是写在 <td...里> 

 <td class="style21" onmouseover="message1" onmouseout="message1" >

如果是要实现什么函数的话 应该是这样

<td onmouseover='fff()'>

<script>
function fff()
{

}
</script>

你也试试  呵呵 有没有哪个高手来解救我们两....... --------------------编程问答-------------------- 在.cs页面里添加
protected void Page_Load(object sender, EventArgs e)
{
   Image1.Attributes.Add("onmouseover","mouse_over(id);");

} --------------------编程问答-------------------- 你的是服务器端控件
你可以再后台服务器端
page_load里面进行绑定
PageNavi_first.Attributes.Add( "OnMouseOut ", "你需要操作的样式或者JS"); 
PageNavi_first.Attributes.Add( "OnMouseOver ", "你需要操作的样式或者JS"); 


你也可以用Jquery
在客户端进行绑定
$("#<%=PageNavi_first.ClientID %>").mouseover(function);
$("#<%=PageNavi_first.ClientID %>").mouseout(function); --------------------编程问答-------------------- 使用jquery比较简洁 --------------------编程问答--------------------
引用 3 楼 chaichangaini 的回复:
你的是服务器端控件
你可以再后台服务器端
page_load里面进行绑定
PageNavi_first.Attributes.Add( "OnMouseOut ", "你需要操作的样式或者JS"); 
PageNavi_first.Attributes.Add( "OnMouseOver ", "你需要操作的样式或者JS"); 


你也可以用Jquery
在客户端进行绑定
$……

顶一下
服务器控件最后在后台写吧 --------------------编程问答-------------------- 参考相关:
http://www.cnblogs.com/insus/archive/2011/06/25/2090071.html
http://www.cnblogs.com/insus/articles/1411057.html
http://www.cnblogs.com/insus/archive/2011/08/18/2143996.html
http://www.cnblogs.com/insus/archive/2011/08/18/2144041.html --------------------编程问答-------------------- Jquery应该简单点吧。。 --------------------编程问答-------------------- 兄弟 我搞掂了 实现的是 鼠标经过图片时显示图片的大图 给你看代码和添加的位置

  <ItemTemplate>
                                    <table>
                                        <tr>                                
                           <td style="width: 100px">
                                               <script language=javascript>
                                                    // JScript 文件
                                                   //*******
                                                   //鼠标移入显示大图片
                                                   //*******
                                                   function yiru(t) {
                                                       var ei = document.getElementById("big_image");
                                                       ei.style.display = "block";
                                                       ei.style.position = "absolute";
                                                       ei.style.top = event.clientY;
                                                       ei.style.left = event.clientX;
                                                       ei.innerHTML = '<img src="' + t.src + '" width="250px" height="250px" />';
                                                       //ei.style.top  =event.clientY+"px";//控制大图片的位置
                                                       //ei.style.left =event.clientX+"px";


                                                   }

                                                   //*******
                                                   //鼠标移出隐藏大图片
                                                   //*******
                                                   function yichu() {
                                                       var ei = document.getElementById("big_image");
                                                       ei.style.display = "none"
                                                       ei.style.top = event.clientY;
                                                       ei.style.left = event.clientX;
                                                   }

                                               </script>
                                                <asp:Image onmouseover="yiru(this)" onmouseout="yichu()" ID="Image10" runat="server" Height="78px"  ImageUrl='<%# Eval("PicUrl") %>'
                                                    Width="87px"  /></td>
                                                    <div id="big_image" onmouseover="yiru(this)" onmouseout="yichu()"></div>
                                        </tr>
                                    </table>
                                </ItemTemplate>
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,