<script type="text/javascript"> $(function () { showhid11($("#nimg1"), $("#nimg1").parent().parent().next()); }); function successupload(file, serverData) { var json = eval("(" + serverData + ")"); var otr = $("<tr></tr>"); $("<td style='padding-bottom: 2px; background-color: #fffff7; padding-left: 4px; padding-right: 4px; vertical-align: top; font-weight: bold; padding-top: 2px;'></td>").text(json.文件名).addClass("tablefirsttd").appendTo(otr); $("<td style='text-align: right; padding-bottom: 2px; background-color: #fffff7; padding-left: 2px; width: 55px; padding-right: 10px; vertical-align: top; padding-top: 2px;'></td>").text(json.文件大小 + 'K').addClass("tablefirsttd").appendTo(otr); $("<td class='md5storage' style='cursor:pointer;padding-bottom: 2px; background-color: #fffff7; padding-left: 4px; width: 30px; padding-right: 4px; vertical-align: top; font-weight: bold; padding-top: 2px;' name=" + JSON.stringify(json) + ">删除</td>") .click(function () { var $this = $(this); $.post("../cat/deletefile.ashx", { 'md5filename': json.md5 }, function (responseText, Textstatus) { if (responseText == 'ok') { $this.parent().remove(); } else { $this.parent().remove(); alert(responseText); } }) }).appendTo(otr); otr.appendTo($("#tabledata")); } $(function () { swfu = new SWFUpload({ // Backend Settings upload_url: "../cat/uploadfile.ashx", post_params: { "ASPSESSID": "<%=Session.SessionID %>" }, // File Upload Settings file_size_limit: "5 MB", file_types: "*", file_types_description: "JPG Images", file_upload_limit: 0, // Zero means unlimited // Event Handler Settings - these functions as defined in Handlers.js // The handlers are not part of SWFUpload but are part of my website and control how // my website reacts to the SWFUpload events. swfupload_preload_handler: preLoad, swfupload_load_failed_handler: loadFailed, file_queue_error_handler: fileQueueError, file_dialog_complete_handler: fileDialogComplete, upload_progress_handler: uploadProgress, upload_error_handler: uploadError, upload_success_handler: successupload, upload_complete_handler: uploadComplete, // Button settings button_image_url: "Images/XPButtonNoText_160x22.png", button_placeholder_id: "uploadbutton", button_width: 80, button_height: 22, button_text: '<span class="button">上传附件</span>', button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }', button_text_top_padding: 1, button_text_left_padding: 5, // Flash Settings flash_url: "../Scripts/swfupload.swf", // Relative to this file flash9_url: "../Scripts/swfupload_FP9.swf", // Relative to this file custom_settings: { upload_target: "uploadtarget" }, // Debug Settings debug: false }); }) </script>
【鏂囦欢鍚峔" 】中右边的引号少了个斜杠
眼力真好
可是我的代码里没有这句话
@Yu: 不是靠的眼力,靠的是Visual Studio
@ChenYa.Liu: 那就是服务端返回时拼接字符串的问题
代码我补充了。可是我另建一个简单的页面。也会报错。包括使用uploadify也是会报这个错的。是不是和浏览器有关啊。因为在谷歌浏览器是好用的。没报错。
@ChenYa.Liu:
还有就是 .uploadSuccess(( 这个地方有两个括号
说明Chrome浏览器的容错性好一些
@dudu: 没有发现
@dudu: 有什么办法先解决乱码问题吗?中文乱码
是不是 post:({}) 这里有问题
swfupload在接受服务端数据时。出现的乱码现象。我已经采用Base64编码跨过这个问题了。