我被劫持的iframe图像上传的jquery代码在FF中工作,而不是Safari。有什么想法吗?

我被劫持的iframe图像上传的jquery代码在FF中工作,而不是Safari。有什么想法吗?,jquery,Jquery,有人知道为什么这在FF中有效,但在Safari中无效吗?当我提醒处理图像并返回图像名称的CF脚本返回时,它在FF中工作。不去旅行 $( "#uploadform" ).submit(function( objEvent ){ //alert("Submit"); var jThis = $( this ); var strName = ("uploader" + (new Date()).getTime()

有人知道为什么这在FF中有效,但在Safari中无效吗?当我提醒处理图像并返回图像名称的CF脚本返回时,它在FF中工作。不去旅行

$( "#uploadform" ).submit(function( objEvent ){
            //alert("Submit");

                var jThis = $( this );
                var strName = ("uploader" + (new Date()).getTime());
                var jFrame = $( "<iframe name=\"" + strName + "\" src=\"about:blank\" />" );
                jFrame.css( "display", "none" );
                jFrame.load(function( objEvent ){
                    var objUploadBody = window.frames[ strName ].document.getElementsByTagName( "body" )[ 0 ];
                    var jBody = $( objUploadBody );
                    var objData = eval(jBody.html());
                    var thumb = ('holding/' + eval(jBody.html()));
                    setTimeout(function(){
                        jFrame.remove();
                            },100);
                if (objData !== '') {
                    // Put the preview here and load another form that has a hidden element capturing the image name
                    // then use a button to save the image, close the window and update the database with all the info
                    // and relaod the main page with a location.reload

                    $('#imagePreview').attr('src', thumb );
                    $('#imageName').html(thumb);
                    $('#imagePreview').click(function(){
                        rebinder();
                        });
                    } else {
                        alert("no thumbnail");
                    }
            });
            $( "body:first" ).append( jFrame );
            jThis
            .attr( "action", "upload_act_single.cfm" )
            .attr( "method", "post" )
            .attr( "enctype", "multipart/form-data" )
            .attr( "encoding", "multipart/form-data" )
            .attr( "target", strName );
        });
$(“#上传表单”).submit(函数(objEvent){
//警报(“提交”);
var jThis=$(本);
var strName=(“上传程序”+(新日期()).getTime());
var jFrame=$(“”);
css(“显示”、“无”);
jFrame.load(函数(objEvent){
var objUploadBody=window.frames[strName].document.getElementsByTagName(“body”)[0];
变量jBody=$(objUploadBody);
var objData=eval(jBody.html());
var thumb=('holding/'+eval(jBody.html());
setTimeout(函数(){
jFrame.remove();
},100);
如果(objData!=''){
//将预览放在这里,然后加载另一个表单,该表单具有捕获图像名称的隐藏元素
//然后使用按钮保存图像,关闭窗口并用所有信息更新数据库
//并使用location.reload重新标记主页
$('#imagePreview').attr('src',thumb);
$('#imageName').html(拇指);
$(“#图像预览”)。单击(函数(){
rebinder();
});
}否则{
警报(“无缩略图”);
}
});
$(“body:first”).append(jFrame);
这
.attr(“action”、“upload\u act\u single.cfm”)
.attr(“方法”、“职位”)
.attr(“enctype”、“多部分/表单数据”)
.attr(“编码”、“多部分/表单数据”)
.attr(“目标”,strName);
});

我想我一定是有一些语法错误把作品搞乱了,但我对这一点还不够了解,所以没有看到它。当我使用警报调用objData变量时,它在Safari中会显示“undefined”。它的行为就像它甚至没有运行CF脚本。。。提前感谢您的帮助。

不要使用about:blank,而是尝试使用body标记创建自己的空HTML。我用Safari4(windows)和Chrome做了一个查看源代码。关于:空白源代码中没有任何内容,不像IE或Firefox中有HTML。试着提醒(objUploadBody),看看是否也收到了任何信息。

谢谢,airmanx86。我决定放弃这个,改用Valum的AjaxUpload插件。