限制图片上传长宽的&#106avascript代码

上传

<html>
<head>
<title>Upload Image</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="IUpload" action="upfile.asp" method="post">
<p><input type="file" name="picsrc" size="40" >
<input type="button" value="上载" ></p></form>
<p><img name="picshow" src="/UploadPic/2007-4/200741191836499.gif" title="图像预览"></p>
</body>
</html>

<SCRIPT LANGUAGE="javascript">
<!--
function imgExceedSize(w,h){
if(!document.IUpload.picsrc.value==""){
if(picshow.width>w||picshow.height>h){
alert("图像尺寸:"+picshow.width+"X"+picshow.height+"。\\n图像尺寸过大!你只能上传尺寸为 "+w+"×"+h+"的图像,请重新浏览图片!");
return true;
}else{
return false;
}
}else{
return true;
}
}

function detect(){
var ok=imgExceedSize(50,50);
if(ok){
document.IUpload.reset();
}else{
document.IUpload.submit();
}
}

//-->
</SCRIPT>

时间: 2024-08-04 05:57:40

限制图片上传长宽的&#106avascript代码的相关文章

限制图片上传长宽的JS代码

js|上传 <html> <head> <title>Upload Image</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body bgcolor="#FFFFFF" text="#000000"> <form

限制图片上传长宽的JavaScript代码

javascript|上传 <html><head><title>Upload Image</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body bgcolor="#FFFFFF" text="#000000"><fo

用JavaScript限制图片上传长宽

javascript|上传 <html><head><title>Upload Image</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body bgcolor="#FFFFFF" text="#000000"><fo

jQuery插件jcrop+Fileapi完美实现图片上传+裁剪+预览的代码分享

  这篇文章主要介绍了jQuery插件jcrop+Fileapi完美实现图片上传+裁剪+预览的代码,非常的简单实用,效果也很棒,有需要的小伙伴可以参考下. 网页端 裁剪图片,不需要经过服务器. 这个是用 https://github.com/mailru/FileAPI 框架实现的.配合jcrop. 高级浏览器 使用 canvas 裁剪,ie6 7 8使用 flash过度. 核心代码: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

jQuery插件jcrop+Fileapi完美实现图片上传+裁剪+预览的代码分享_jquery

网页端 裁剪图片,不需要经过服务器. 这个是用 https://github.com/mailru/FileAPI 框架实现的.配合jcrop. 高级浏览器 使用 canvas 裁剪,ie6 7 8使用 flash过度. 核心代码: var el = $('input').get(0); seajs.use(['gallery/jcrop/0.9.12/jcrop.css','gallery/jcrop/0.9.12/jcrop.js'] ,function(){ FileAPI.event.o

jquery 图片上传本地预览效果代码

 代码如下 复制代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.111cn.net /1999/xhtml" > <head>     <meta http-

多图片上传asp.net实现程序代码

前台代码如下:  代码如下 复制代码 <% @ Page Language="C#" CodeFile="UploadImg.aspx.cs" Inherits="NetAdmin_APicture_UploadImg" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xh

兼容IE和FF的图片上传前预览js代码_javascript技巧

效果图如下:  代码如下: 复制代码 代码如下: <!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

模拟QQ心情图片上传预览示例_实用技巧

出于安全性能的考虑,目前js端不支持获取本地图片进行预览,正好在做一款类似于QQ心情的发布框,找了不少jquery插件,没几个能满足需求,因此自己使用SWFuplad来实现这个图片上传预览. 先粘上以下插件,在别的图片上传功能说不定各位能用的上. 1.jQuery File Upload Demo地址:http://blueimp.github.io/jQuery-File-Upload/ 优点是使用jquery进行图片的异步上传,可控性好,可根据自己的需求任意定制: 缺点是在IE9等一些浏览器