Home >php教程 >PHP开发 >window.dialogArguments usage instructions

window.dialogArguments usage instructions

高洛峰
高洛峰Original
2017-01-04 17:26:541569browse

f1.php page JS code, the second passed parameter must be self and cannot be anything else

<script type="text/javascript"> 
function dianJi(){ 
//弹出窗口关闭前,原窗口不能获得焦点 
//showModalDialog("f2.php",self,"dialogwidth=500px;dialogheight=500px;dialogtop=100px;dialogleft=100px;center=no;help=no;resizable=no;status=no;scroll=yes"); 
//弹出窗口不影响原窗口获得焦点 
window.showModelessDialog("f2.php",self,"dialogwidth=500px;dialogheight=500px;dialogtop=100px;dialogleft=100px;center=no;help=no;resizable=no;status=no;scroll=yes"); 
} 
function back_db(a){ 
$("input[name=&#39;text2&#39;]").val(a); 
} 
</script>

HTML code

<input type="button" onclick="dianJi()" value="触发"/> 
<input type="text" id="text1" value="hello world!"/> 
<input type="text" name="text2" value="hello!"/>

f2.php page, parent.dialogArguments and window. dialogArguments has the same effect, and getElementById must be used here, and getElementByName cannot be used

<script type="text/javascript"> 
//parent.dialogArguments.document.getElementById("text1").value="你好世界!"; 
window.dialogArguments.document.getElementById("text1").value="你好世界!"; 
window.dialogArguments.back_db("你好!"); 
</script>


For more window.dialogArguments usage instructions, please pay attention to the PHP Chinese website!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn