js json 提交
来源:互联网 发布:哪个剪辑软件最快 编辑:程序博客网 时间:2024/04/30 00:57
<script type="text/javascript" language="javascript"> var random; var ids; //添加文件 监听 function addRow(){var rom=changeRandom();var txt2=getFileText();var divfilelist = document.getElementById("divfilelist");var f = document.createElement('div');f.setAttribute("id","f"+rom);var input = document.createElement('span');input.setAttribute("id","p"+rom);input.innerHTML =txt2;f.appendChild(input);var status = document.createElement('span');status.innerHTML ='开始上传中.......>>>';status.setAttribute("class","status");status.setAttribute("id","s"+rom);f.appendChild(status);var a = document.createElement('a');a.innerHTML ='>>>del>>>';a.setAttribute("class","status");a.setAttribute("id","a"+rom);a.setAttribute("href","#");a.setAttribute("onClick","delFile("+rom+")");f.appendChild(a);divfilelist.appendChild(f);ids=rom;subfile();}//获得10位数 随机数function changeRandom(){var random=''+Math.random();return random.substr((random.length-10),random.length);}function changeTxt(id,txt){document.getElementById(id).innerHTML=txt;}function getFileText(){ var id=document.getElementById("idfileName") var obj=id.value; var aa=obj.split('\\'); //var txt=aa[aa.length-1]; //jpg 结果 var txt=obj.substr((obj.lastIndexOf('\\')+1),obj.length); return txt;}function FileUpload_onselect() { var id=document.getElementById("idfileName") var obj=id.value; var aa=obj.split('\\'); //var txt=aa[aa.length-1]; //jpg 结果 var txt=obj.substr((obj.lastIndexOf('\\')+1),obj.length); id.value=txt; } function delFile(id){$("#f"+id).remove();$("#s"+id).remove();$("#p"+id).remove();$("#a"+id).remove();//清除掉之前的//var idfileName=document.getElementById("idfileName");//idfileName.value='';}// 浏览器 类型function checkBrowser() { var ug = navigator.userAgent.toLowerCase(); var browserType = ""; var ver = ""; //检测IE及版本 var IE = ug.match(/msie\s*\d\.\d/); //提取浏览器类型及版本信息,注match()方法返回的是数组而不是字符串 var isIE = check(/msie/); if(isIE) { browserType = "Internet Explorer"; } //检测chrome及版本 var chrome = ug.match(/chrome\/\d\.\d/gi); var isChrome = check(/chrome/); if(isChrome) { browserType = "Chrome"; } //检测firefox及版本 var firefox = ug.match(/firefox\/\d\.\d/gi); var isFirefox = check(/firefox/); if(isFirefox) { browserType = "Firefox"; } return browserType; } function check(reg) { var ug = navigator.userAgent.toLowerCase(); return reg.test(ug); } </script><script type="text/javascript">//文件上传 后台function subfile() {changeText("#"+ids,"start上传中....");var p = $("#idfileName").val();//var ju=judgeBrows();alert('safd'+checkBrowser());$.ajax( { type : "post", dateType:'text', data: "fileupload="+p+"&random="+ids,//提交表单,相当于, url : "<%=basePath%>tvs/dealUploadFile.action",success : update_page ,error : function(msg) {changeText("#s"+ids,"上传失败..");//changeText("#result","上传失败..");}});}function changeText(re,str){$(re).text(str); }//参数obj为input file对象function update_page(info){ var json=eval(info); var str=json.info; changeText("#s"+ids,str);}</script>
0 0
- js json 提交
- 提交 form表单js转成json
- js以json形式提交数据,后台接受
- Ajax提交,对象转换成json,在js中解析?
- js对象定义,表格数据转成json上传提交
- 原生js的Ajax提交json数据到后台
- js提交
- json 跨域 表单提交
- Ajax提交json数据
- httpclient提交json参数
- POST提交JSON数据
- 模拟post提交json
- httpclient提交json参数
- AJAX-requestBody-提交JSON
- ajax提交json数组.
- go提交json、获取json、解析json
- js动态添加行hiddenfield保存xml或json 数据 提交给后台处理
- js封装from表单数据为json串进行ajax提交
- Logistic回归与sigmoid
- c 实现斐波那契(fibonacii)数列
- css空白边叠加的几种情况介绍
- 黑马程序员——IOS基础——Copy
- svn
- js json 提交
- PLSQL Developer 通过oracle客户端 连接oracle
- 服务器集群学习笔记
- python中列表的pop、remove、-1
- DWR使用详解
- CStdioFile 读取unicade环境下乱码处理
- 关于android中调用系统拍照,返回图片是旋转90度..
- Android代码混淆
- AnimationPacker重写