Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用iframe时在上传表单上回显PHP中的jQuery脚本_Php_Javascript_Jquery_Iframe - Fatal编程技术网

使用iframe时在上传表单上回显PHP中的jQuery脚本

使用iframe时在上传表单上回显PHP中的jQuery脚本,php,javascript,jquery,iframe,Php,Javascript,Jquery,Iframe,我的文件上传有以下HTML代码 <div id="status"></div> <iframe name="upifrm" src="" style="display:none;"></iframe> <form name="myForm" id="myForm" action="upload.php" method="post" enctype="multipart/form-data" target="upifrm"> <

我的文件上传有以下HTML代码

<div id="status"></div>

<iframe name="upifrm" src="" style="display:none;"></iframe>

<form name="myForm" id="myForm" action="upload.php" method="post" enctype="multipart/form-data" target="upifrm">
<label for="fileinput" id="brsbtn" class="labtrigg">label</label> 
<input type="file" id="fileinput" name="file" />
</form>

<div id="atchs"></div>

标签
在upload.php文件的末尾

// . . . . . . . . . . . . .     
// $message declaration . . .

echo '<script>
parent.document.getElementById("myForm").reset(); 
parent.document.getElementById("status").innerHTML="'.$message.'";
$("#atchs", window.parent.document).after("<span>something</span>");
</script>';
/。
//$message声明。
回声'
parent.document.getElementById(“myForm”).reset();
parent.document.getElementById(“status”).innerHTML=“”.$message.”;
$(“#atchs”,window.parent.document);
';
前两行工作得很好(它们是用纯Javascript代码编写的),但我在第三行遇到了错误

$("#atchs", window.parent.document).after("<span>something</span>");
$(“#atchs”,window.parent.document);

“预期目标”。如何解决此问题?

即使包含jQuery,这里也应该有一个函数名:

$("#atchs", window.parent.document).("<span>something</span>");
                                    ^^^
$(“atchs”,window.parent.document)(“某物”);
^^^
类似于
append
prepend
html
text
,或者任何你想做的事情。它不能只是一个点和括号。

试试这个 确保在父页面中包含了
jQuery
文件

top.jQuery("#atchs").html("<span>something</span>");
top.jQuery(“atchs”).html(“某物”);

希望这有意义

您调用
$(“#atchs”,window.parent.document)。(“某物”)在iframe中?iframe中是否包含jquery?前两行是传统的js,为什么在第三行使用jquery方法?我在主HTML文件中包含了jquery。Iframe位于这个HTML文件中。Rikesh,我想在jQuery中重写整个代码,所以上面的代码只是一个示例。谢谢。
window.parent.document
<。我测试过了非常感谢你Dianuj!