做了小程序没人用_JS获取input[file]的值并显示在页
摘要: JS获得input[file]的值并显示信息在网页页面的完成方式 下边网编就为大伙儿共享一篇JS获得input[file]的值并显示信息在网页页面的完成方式,具备非常好的参照使用价值,期待对大伙...
if (window.createObjectURL != undefined) { // basic url = window.createObjectURL(file); } else if (window.URL != undefined) { // mozilla(firefox) url = window.URL.createObjectURL(file); } else if (window.webkitURL != undefined) { // webkit or chrome url = window.webkitURL.createObjectURL(file); return url; var objUrl = getObjectURL(this.files[0]); console.log("objUrl = " + objUrl); var html = ' div img src="' + objUrl + '" alt="" div p 删除 /p /div /div $(this).parent().parent().append(html); })
以上这篇JS获取input[file]的值并显示在页面的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持凡科。