我有一container.DataItem("netpic"),想根据她是否为空来选择IMG标签是否显示,我已经写了个函数来判断它是否为空而返回TRUE和FALSE,但好像只有ASP.NET的IMG控件支持VISIBLE属性?,所以我添加的是个.NET的IMG控件,但我又想实现下面这个JAVASCRPT功能:onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击查看全图';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(this.resized) window.open(page)"
.NET的IMG控件控件能吗?我看帮助说是不支持任何事件????!!

解决方案 »

  1.   

    "好像只有ASP.NET的IMG控件支持VISIBLE属性"
     不对
    大多控件都支持VISIBLE属性!
    其他不会!
      

  2.   

    image1.Attributes.Add("onload","if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击查看全图';}")这样不可以吗?
      

  3.   

    使用后台添加
    in page_loadimg.Attributes["onmouseover"]=.......通过js控制控件(obj)是否可见 如下:
    obj.style.display="" or obj.style.display="block" //可见
    obj.style.display="none"  //不可见
      

  4.   

    "使用后台添加
    in page_loadimg.Attributes["onmouseover"]=......."
    如果img这控件定义在datalist之外还好,如果是在datalist里面会提示"img"未定义,该怎么解决?
      

  5.   

    in page_loadfor(int i=0;i<this.DataList1.Items.Count;i++)
    {
    System.Web.UI.WebControls.Image img=(Image)this.DataList1.Items[i].FindControl("img");
    img.Attributes["onmouseover"]=......."
    }
      

  6.   

    哇,红星星就是厉害唉,我什么时候才能达到这个水平呀.FINDCONTROL,和addattributes我都不知道.还好问题终于圆满解决,感谢啦.