我正在尝试在我拥有的表单上实现SWFUpload。但是,它没有标识占位符。我的代码在下面,有人能帮忙吗?如果有帮助的话,我正在使用jQuery。
<script type="text/javascript" src="{{ MEDIA_URL }}/js/SWFUpload-2.5.0/swfupload/swfupload.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/js/SWFUpload-2.5.0/swfupload/swfupload.cookies.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/js/foo.js"></script>
<script type="text/javascript">
$(swfupload("{% url swfupload %}","{{ MEDIA_URL }}/js/SWFUpload-2.5.0/swfupload/swfupload.swf"));
</script>
<div id="upload_btn"></div>
Javascript(foo.js):
swfupload = function(upload_url, flash_url) {
var swfupload_real = new SWFUpload({
debug: false,
upload_url: upload_url,
flash_url: flash_url,
button_placeholder_id: "upload_btn",
button_width: "40",
button_height: "16",
button_cursor: SWFUpload.CURSOR.HAND,
button_text: "Click",
file_size_limit: "20 MB",
file_dialog_complete_handler: function() { this.startUpload(); },
upload_complete_handler: function() { this.startUpload(); },
});
};
targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
我试着看看发生了什么难以置信地,
document.GetElementByID
返回null,而
$('#'+this.settings.button_placeholder_id)