protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        ImageButton imb = e.Item.FindControl("ImageButton2") as ImageButton ;
        
        imb.Attributes.Add("onMouseOver", "show();");
      
    }show()中的代码该如何写,(datalist1中调用了数据库显示图片,显示后有N张图片),才能实现鼠标移动到某一张图片上 使它边框变色

解决方案 »

  1.   


    function show(){
    $("img").hover(function(){
    $(this).css({borderColor:"Red"});
    },
    function(){
    $(this).css({border:none});
    });
    }
      

  2.   

    找到ImageButton控件,然后
    //当鼠标停留时更改背景色
       e.Row.Attributes.Add  ("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
    当鼠标移开时还原背景色
       e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
      

  3.   

    ImageButton imb = e.Item.FindControl("ImageButton2") as ImageButton ;//当鼠标停留时更改背景色
       imb.Attributes.Add ("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
    当鼠标移开时还原背景色
       imb.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
      

  4.   

     this.aa.Attributes.Add("onmouseover", "this.style.border='solid 1px #000'");
      

  5.   

    谢谢各位,luo_yuee的调试成功。希望与各位交朋友。