jq加点js控制图片的宽度
这个代码放在</body>的前面
function autopic()
{
$("#cont img").each(function(i){
if(this.width>600){this.width=600;}
});
$("#content img").each(function(i){
if(this.width>200){this.width=200;}
if(this.height>160){
this.height=160;
}
});
}
{
$("#cont img").each(function(i){
if(this.width>600){this.width=600;}
});
$("#content img").each(function(i){
if(this.width>200){this.width=200;}
if(this.height>160){
this.height=160;
}
});
}
这个代码下在html的后面
<script type="text/javascript">
if (document.readyState=="complete")
{
autopic();
}
else
{
document.onreadystatechange = function()
{
if (document.readyState == "complete")
{
autopic();
}
}
}
</script>
if (document.readyState=="complete")
{
autopic();
}
else
{
document.onreadystatechange = function()
{
if (document.readyState == "complete")
{
autopic();
}
}
}
</script>
马云说
葬花吟 程序员版
