Html JS 小技巧
来源:互联网 发布:windows android忘仙 编辑:程序博客网 时间:2024/05/21 22:51
文件上传,可通过JS建一个FormData,然后通过获取选中文件的,进行异步提交
var fd = new FormData();
fd.append("upload", 1);
fd.append("file1", $("#file1").get(0).files[0]);
fd.append("file2", $("#file2").get(0).files[0]);
fd.append("file3", $("#file3").get(0).files[0]);
fd.append("file4", $("#file4").get(0).files[0]);
$.ajax({
url: "/file/uploads",
type: "POST",
processData: false,
contentType: false,
data: fd,
success: function(d) {
console.log(d)
}
});
通过JS 控制打开新页面
1、 window.open("link")
2、 var a = $("<a href='link" "' target='_blank'>new </a>").get(0);
var e = document.createEvent('MouseEvents');
e.initEvent( 'click', true, true );
a.dispatchEvent(e);
- Html JS 小技巧
- html+css+js小技巧
- 【HTML】html 小技巧
- css,html,js/jQuery开发小技巧汇总-更新中~
- HTML中的小技巧
- HTML小技巧
- html、javascript小技巧
- HTML小技巧
- HTML小技巧
- web html小技巧
- HTML小技巧
- html 小技巧
- html常用小技巧
- html中的小技巧
- html小技巧
- html实用小技巧
- HTML一些小技巧
- html 小技巧
- Hadoop2.7集群安装
- RabbitMQ Java 实例
- mysql 下locate和find_in_set的使用
- Cannot resolve corresponding JNI function
- **YII** 系列七Database
- Html JS 小技巧
- ViewPager在首尾页滑动切换
- C语言快速查找与二分查找0804
- jQuery自定义表单验证
- vim编码方式的设置
- ./rabbitmq-server:行63: erl: 未找到命令
- ubuntu下 Gedit 中文乱码(命令行模式简单)
- 百度地图API获取发布版SHA1
- Qt之findChild