用script脚本写个判断问题 请教下根据图片大小,判断当图片宽大于500px的时候图片宽缩小到500,高按比例缩放,宽小于500的时候原图显示,该怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script type="text/javascript">window.onload = function() { var imgs = document.getElementById('container').getElementsByTagName('img'); for(var i = 0; i < imgs.length; i ++) { if (imgs[i].width > 500) { imgs[i].width = '500'; imgs[i].heigth = ''; } }}</script></head><body><div id="container"> <img src="http://res1.windows.microsoft.com/resbox/en/Windows%207/main/0e8c5cfc-9b44-4c4c-8cb2-c3cab50c908c_6.jpg" /><br /> <img src="http://res2.windows.microsoft.com/resbox/en/Windows%207/main/b4697528-c130-4dec-a943-ac069fbbe238_8.jpg" /></div></body></html> Ext GridPanel的cellclick 部分 无效.. js实用小技巧 JS.跪求高手 showModalDialog问题 加了setTimeout,代码执行顺序就出问题了,如何让代码顺序执行? 又是数据验证!!简单,但是我找不出来出错在哪里!! js控制checkbox重置 怎么到到name="001"的值 Javascript的终级..... 求大神分析两个值是如何生成的srpla和srplm1 js代码求助,堵住了,很急很急! help! 函数参数问题
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload = function() {
var imgs = document.getElementById('container').getElementsByTagName('img');
for(var i = 0; i < imgs.length; i ++) {
if (imgs[i].width > 500) {
imgs[i].width = '500';
imgs[i].heigth = '';
}
}
}
</script>
</head><body>
<div id="container">
<img src="http://res1.windows.microsoft.com/resbox/en/Windows%207/main/0e8c5cfc-9b44-4c4c-8cb2-c3cab50c908c_6.jpg" /><br />
<img src="http://res2.windows.microsoft.com/resbox/en/Windows%207/main/b4697528-c130-4dec-a943-ac069fbbe238_8.jpg" />
</div>
</body>
</html>