This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function change() { | |
var pic = document.getElementById("preview"); | |
var file = document.getElementById("f"); | |
var ext=file.value.substring(file.value.lastIndexOf(".")+1).toLowerCase(); | |
// gif在IE浏览器暂时无法显示 | |
if(ext!='png'&&ext!='jpg'&&ext!='jpeg'){ | |
alert("文件必须为图片!"); return; | |
} | |
// IE浏览器 | |
if (document.all) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = function(){ | |
// 呈现引擎 | |
var engine = { | |
ie: 0, | |
gecko: 0, | |
webkit: 0, | |
khtml: 0, | |
opera: 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zh-cn"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="author" content="EdieLei" /> | |
<title>HTML5 图片上传预览</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
$('#img').change(function(){ |