zoukankan      html  css  js  c++  java
  • 把重设新闻中图片尺寸的代码贴出来了,ie8测试通过

    代码如下:

    我做的只是控制等比例在某个宽度下,适用一般情况了,特别的控制,你自己发散一下思维就可以了。

     <script language="javascript" type="text/javascript">
                        //重设图片尺寸
                        var imgC=document.getElementById("imgC");
                        var limitWidth=570;
                        var imgArr=imgC.getElementsByTagName("img");
                        for(var i=0;i<imgArr.length;i++)
                        {
                            var imgObj=imgArr[i];
                            imgObj.onload=function()
                            {
                                if(this.width)
                                {
                                    var orazW=this.width;
        var orazH=this.height;
                                    if(orazW>limitWidth)
                                    {
                                    //this.rel="lightbox";
                                    this.width=limitWidth;
                                    this.height=(this.width*orazH)/orazW;
                                    this.title="点击查看大图";
                                    this.style.cursor = 'hand';
                                    this.onclick=function(){ var mw = showBigImg("imgShow.aspx", this.src, window.screen.availWidth-100, window.screen.availHeight-100);}
                                    }
                                }
                            }
                        }
                </script>

  • 相关阅读:
    linux下启动和关闭网卡命令及DHCP上网
    python 编码问题
    paddlepaddle
    Convolutional Neural Network Architectures for Matching Natural Language Sentences
    deep learning RNN
    Learning Structured Representation for Text Classification via Reinforcement Learning 学习笔记
    Python IO密集型任务、计算密集型任务,以及多线程、多进程
    EM 算法最好的解释
    tensorflow 调参过程
    tensorflow 学习纪录(持续更新)
  • 原文地址:https://www.cnblogs.com/zhangsir/p/1435560.html
Copyright © 2011-2022 走看看