<img border=0  src=http://127.0.0.1/heihei/UpFile/UpAttachment/2009-11/2009112512343.jpg onload="javascript:javascript:if(this.width>screen.width-500)this.width=screen.width-500">这段代码在新建的一个静态页面里测试可以起到作用。但就是在网站中的文章查看中不起作用,图片还是原使大小,请问大家这是什么原因呢?

解决方案 »

  1.   

    onload 后面的那段JS代码好像不执行。
      

  2.   

    写成JS方法
    alert分步骤结果测试看看
      

  3.   

    <img border=0  src=http://pic1.nipic.com/2008-11-13/2008111383651175_2.jpg onload="javascript:if(this.width>screen.width-500)this.width=screen.width-500"> 
      

  4.   

    <script type="text/javascript">
      function aa(tag){
        tag.width=160;
        tag.height=160;
    }
    </script><img id="picshow" src="images/Winter.jpg" onload="aa(this)">
      

  5.   

    <script type="text/javascript"> 
      function aa(tag){ 
        alert('1');
        tag.width=160; 
        tag.height=160; 
        alert('2');

    </script> 
     alert('2');有的时候不执行。。