主题:  请高手一定研究一下!谢谢!

伊不能静

职务:普通成员
等级:1
金币:1.0
发贴:147
注册:2001/10/5 16:30:08
#12001/11/5 9:06:46
我有DW的插件JustSoPicWindow做一个图片页面,但有我不满意的地方,因为它的图片不能完整显示,它约束了比例。我想改动一下代码,但不成功,JS高手请帮忙!
这是页面代码:


Untitled Document






JustSo Temporary Layer

Paste these images/table to your page

- then remove this layer

If broken image icons appear here, simply save, close and re-open this document















这是vwd_justsopw.js代码:
    if (bgcolor=="") {
        bgcolor="#FFFFFF";
    }
    var adj=10, lift;
    var w = screen.width;
    var h = screen.height;
    var byFactor=1;

    if(w<740){
     lift=0.90;
    }
    if(w>=740 & w<835){
     lift=0.91;
    }
    if(w>=835){
     lift=0.93;
    }
    if (imageWidth>w){    
     byFactor = w / imageWidth;            
     imageWidth = w;
     imageHeight = imageHeight * byFactor;
    }
    if (imageHeight>h-adj){
     byFactor = h / imageHeight;
     imageWidth = (imageWidth * byFactor);
     imageHeight = h;
    }
    
    var scrWidth = w-adj;
    var scrHeight = (h*lift)-adj;

    if (imageHeight>scrHeight){
     imageHeight=imageHeight*lift;
     imageWidth=imageWidth*lift;
    }

    var posLeft=0;
    var posTop=0;

    if (hugger == "hug image"){
     if (hugMargin == ""){
     hugMargin = 0;
     }
     var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
     if (scrHeightTemp < scrHeight) {
        scrHeight = scrHeightTemp;
     }
     var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
     if (scrWidthTemp < scrWidth) {
        scrWidth = scrWidthTemp;
     }
    
     if (scrHeight<100){scrHeight=100;}
     if (scrWidth<100){scrWidth=100;}

     posTop = ((h-(scrHeight/lift)-adj)/2);
     posLeft = ((w-(scrWidth)-adj)/2);
    }

    if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
        imageHeight=imageHeight-adj;
        imageWidth=imageWidth-adj;
    }

    var agt=navigator.userAgent.toLowerCase();
    if (agt.indexOf("opera") != -1){
     var args= new Array();
     args[0]='parent';
     args[1]=imageName;
     var i ; document.MM_returnvalue = false;
     for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
    } else {
    newWindow = window.open("vwd_justso.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
    newWindow.document.open();
    newWindow.document.write(''+alt+'');
    newWindow.document.write('
');
    newWindow.document.write('Click screen to close');
    newWindow.document.write('
');
    newWindow.document.close();
    newWindow.focus();
    }
}
//-->

请高手一定研究一下!谢谢!

编辑历史:[这消息被哈哈品编辑过(编辑时间2001-11-05 09:23:13)]