<pre name="code" class="javascript">$(".addimg-LiuLan").change(function(){
var objUrl = getObjectURL(this.files[0]) ;//获取文件
console.log("objUrl = "+objUrl) ;
if (objUrl) {
$(".addimg-Kuang").attr("src", objUrl) ;
}
}) ;
function getObjectURL(file) {
var url = null ;
if (window.createObjectURL!=undefined) { //
basicurl = window.createObjectURL(file) ;
} else if (window.URL!=undefined) { //
mozilla(firefox)url = window.URL.createObjectURL(file) ;
} else if (window.webkitURL!=undefined) { //
webkit or chromeurl = window.webkitURL.createObjectURL(file) ;
}return url ;}