jquery异步上传组件SmartUpload
源码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SmartUpload</title>
<link rel="stylesheet" href="reset.css"></link>
<link rel="stylesheet" href="demo.css"></link>
<style>
@media screen and (-webkit-min-device-pixel-ratio:0){ .ks-smartupload-file {margin-left:-370px;} } /*chrome and safari*/
</style>
</head>
<body>
<h1>SmartUpload(Default)</h1>
<div>默认模式</div>
<div class="wrapper"><a href='#' id="J_btn" class='J_btn'>上传</a></div>
<script type="text/javascript" src="jquery-latest.min.js"></script>
<script type="text/javascript" src="smartupload.js"></script>
<script type="text/javascript">
(function($){
/**
* $.fn.SmartUpload(target,cfg)
* @param target 上传按钮
* @param cfg 配置项
*
*/ var title = "";
var su = new $.fn.SmartUpload("#J_btn",{
//上传类型
type:"iframe",
//上传路径
url:"upload.php",
//返回类型
//dataType:"json",
fileName:"fileData",
//回调
success:function(data){
//callback
alert(data);
}
});
$("#J_submit").click(function(){
//可以传输动态获取的数据至服务器
su.setData({"sendData":$("#J_param_text").val()});
su.submit();
});
})(jQuery);
</script>
</body>
</html>
补充:web前端 , JavaScript ,