日期:2014-05-16  浏览次数:20346 次

JS代码在火狐中不兼容,高手帮忙看一下
if(a.width/a.height>w/h){
  thisp.height=w*a.height/a.width; /*不对图片拉伸*/ 
  thisp.width=w;
   
  var last_h=h-thisp.height
  var margin_h=last_h/2;
  thisp.style["paddingTop"]=margin_h;
  thisp.style["paddingBottom"]=margin_h;
}else{
  thisp.width=h*a.width/a.height; 
  thisp.height=h;
  var last_w=w-thisp.width
  var margin_w=last_w/2;
  thisp.style["paddingLeft"]=margin_w;
  thisp.style["paddingRight"]=margin_w;
}


在IE下全正常的,但在火狐中不起作用。

------解决方案--------------------
不太懂你这个效果!
------解决方案--------------------
JScript code
thisp.height=w*a.height/a.width + 'px'; /*不对图片拉伸*/  
thisp.width=w + 'px';