如何拿到SWFUpload addBtn 的点击事件
2个回答
2014-12-14
展开全部
您好,很高兴能帮助您,
把这段代码放在</body>之前。
这样页面中的全部HTML元素均已经被加载并且也经过浏览器的渲染,css已被应用并呈现样式效果,此时再来加载swfupload。至于按钮的显示,需要在swfupload的调用中,指定:button_placeholder_id: "按钮容器ID"
给你一段我在用的代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script type="text/javascript">
var swfu;
window.onload = function() {
var settings = {
flash_url : "swfupload.swf",
upload_url: "upload.php",
post_params: {"a_sessid": "{session_id()}"},
file_post_name: "upImg",
file_size_limit : "2 MB",
file_types : "*.jpg|*.jpeg|*.png",
file_types_description : "图片文件",
file_upload_limit : 10,
file_queue_limit : 10,
debug: false,
button_image_url: "swfuploadbtnimg.gif", //这里是上传按钮用到的小图片
button_width: 130, //上传按钮的宽
button_height: 18, //上传按钮的高
button_placeholder_id: "spanButtonPlaceholder", //这里就是上传按钮要应用到的容器的ID号
button_text: '<span class="buttonfont">点击批量上传图片</span>', //按钮的文字样式
button_text_style: ".buttonfont{color:#0240A3;}", //按钮的文字css代码
button_text_top_padding: 0,
button_text_left_padding: 18,
button_cursor: SWFUpload.CURSOR.HAND, //鼠标样式
button_action: SWFUpload.BUTTON_ACTION.SELECT_FILES, //单文件上传还是多文件上传
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT, //按钮的flash模式,这里用透明才好使用css样式
file_queue_error_handler: fileQueueError,
file_dialog_complete_handler: fileDialogComplete,
upload_progress_handler: uploadProgress,
upload_error_handler: uploadError,
upload_success_handler: uploadSuccess,
upload_complete_handler: uploadComplete,
custom_settings: {
upload_target : "divFileProgressContainer" //处理上传并显示进度的容器ID
}
};
swfu = new SWFUpload(settings);
};
</script>
你的采纳是我前进的动力,还有不懂的地方,请你继续“追问”!
如你还有别的问题,可另外向我求助;答题不易,互相理解,互相帮助!
把这段代码放在</body>之前。
这样页面中的全部HTML元素均已经被加载并且也经过浏览器的渲染,css已被应用并呈现样式效果,此时再来加载swfupload。至于按钮的显示,需要在swfupload的调用中,指定:button_placeholder_id: "按钮容器ID"
给你一段我在用的代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script type="text/javascript">
var swfu;
window.onload = function() {
var settings = {
flash_url : "swfupload.swf",
upload_url: "upload.php",
post_params: {"a_sessid": "{session_id()}"},
file_post_name: "upImg",
file_size_limit : "2 MB",
file_types : "*.jpg|*.jpeg|*.png",
file_types_description : "图片文件",
file_upload_limit : 10,
file_queue_limit : 10,
debug: false,
button_image_url: "swfuploadbtnimg.gif", //这里是上传按钮用到的小图片
button_width: 130, //上传按钮的宽
button_height: 18, //上传按钮的高
button_placeholder_id: "spanButtonPlaceholder", //这里就是上传按钮要应用到的容器的ID号
button_text: '<span class="buttonfont">点击批量上传图片</span>', //按钮的文字样式
button_text_style: ".buttonfont{color:#0240A3;}", //按钮的文字css代码
button_text_top_padding: 0,
button_text_left_padding: 18,
button_cursor: SWFUpload.CURSOR.HAND, //鼠标样式
button_action: SWFUpload.BUTTON_ACTION.SELECT_FILES, //单文件上传还是多文件上传
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT, //按钮的flash模式,这里用透明才好使用css样式
file_queue_error_handler: fileQueueError,
file_dialog_complete_handler: fileDialogComplete,
upload_progress_handler: uploadProgress,
upload_error_handler: uploadError,
upload_success_handler: uploadSuccess,
upload_complete_handler: uploadComplete,
custom_settings: {
upload_target : "divFileProgressContainer" //处理上传并显示进度的容器ID
}
};
swfu = new SWFUpload(settings);
};
</script>
你的采纳是我前进的动力,还有不懂的地方,请你继续“追问”!
如你还有别的问题,可另外向我求助;答题不易,互相理解,互相帮助!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询