/**
* 图片自适应容器
* 使用方式 <img src='' autoFixImg(400, 400);' />
*/
function autoFixImg(obj, maxW, maxH) {
var imgH = obj.height;
var imgW = obj.width;
if(obj.height > maxH) {
obj.heigth = maxH;
obj.widht = (obj.width * (maxH / imgH));
imgH = maxH;
imgW = obj.width;
}
if(obj.width > maxW) {
obj.width = maxW;
obj.height = (maxW / imgW) * imgH;
imgW = maxW;
imgH = obj.height;
}
obj.style.marginTop = (maxH - obj.height) / 2;
obj.style.marginLeft = (maxW - obj.width) / 2;
}
// 获取get请求的参数
//获取指定参数名的参数值
function getQueryParameter(qs)
{
var s = location.href;
alert(s);
s = s.replace("?","?&").split("&");//这样可以保证第一个参数也能分出来
alert(s);
var re = "";
for(i=1;i<s.length;i++)
if(s[i].indexOf(qs+"=")==0)
re = s[i].replace(qs+"=","");//取代前面的参数名,只剩下参数值
return re;
}