上传文件的问题,大家来看看 不需要知道图片的长度也可以上传图片的!在显示图片时给出图片的长和宽,图片会按实现的长宽显示! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 少写一个字,重发!不需要知道图片的长度也可以上传图片的!在显示图片时不给出图片的长和宽,图片会按实现的长宽显示! 我就是想要知道他的长和宽,因为如果用原始的尺寸可能会把页面撑乱掉的,能不 能 取呀??? <SCRIPT language=javascript>function index_image_valid(){ var img=new Image(); img.src=document.pho_up.pho_index.value; imagewidth=img.width; imageheigth=img.height; fsize=img.fileSize/1024; fsize=fsize.toFixed(1); document.pho_up.cmd.disabled=true; if(img.readyState!="complete") window.setTimeout("index_image_valid()",10); else {alert ("宽:"+imagewidth+"\n高:"+imageheigth+"\n大小:"+fsize+" KB"); document.pho_up.cmd.disabled=false}}</script></head><form name="pho_up" method="post" enctype="multipart/form-data"><input type="file" name="pho_index" size="20"><input type=button name="cmd" value="测试图片大小" onclick="index_image_valid();"> </form> 一个关于Javascript的问题 正则新手求高手指点 下面的arguments[0]什么意思? 关于回车事件 【~~求无间隙向左滚动代码~~】 怎么才能通过脚本将IE的缓存清空??? 请教:网页引用JS文件 在IE下报错 FF下正常! Object的SRC怎么取不到? 怎样将js文件中的脚本加密? jwplayer播放器怎么设置关闭按钮(在线等) 如何实现页面跳转后select里的值不复位,而是显示跳转之前所选的值???在线.... 打印兄弟框架的内容(同在一个父框架集中)
不需要知道图片的长度也可以上传图片的!在显示图片时不给出图片的长和宽,图片会按实现的长宽显示!
function index_image_valid(){
var img=new Image();
img.src=document.pho_up.pho_index.value;
imagewidth=img.width;
imageheigth=img.height;
fsize=img.fileSize/1024;
fsize=fsize.toFixed(1);
document.pho_up.cmd.disabled=true;
if(img.readyState!="complete")
window.setTimeout("index_image_valid()",10);
else
{alert ("宽:"+imagewidth+"\n高:"+imageheigth+"\n大小:"+fsize+" KB");
document.pho_up.cmd.disabled=false}
}
</script>
</head>
<form name="pho_up" method="post" enctype="multipart/form-data">
<input type="file" name="pho_index" size="20">
<input type=button name="cmd" value="测试图片大小" onclick="index_image_valid();">
</form>