window.returnValue使用方法
来源:互联网 发布:淘宝日用品比较好的店 编辑:程序博客网 时间:2024/04/29 09:25
returnValue是javascript中html的window对象的属性,
目的是返回窗口值,当用window.showModalDialog函数打开一个IE的模式窗口(模式窗口就是打开后不能操作父窗口,只能等模式窗口关闭时才能操作)时,用于返回窗口的值,下面举个例子:
1、parent.html
Html代码
//father.html
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<script language="javascript">
function showmodal(){
var ret = window.showModalDialog("child.htm",null,"dialogWidth:350px;dialogHeight:350px;help:no;status:no");
if (ret){
alert('子窗口返回真!');
}else{
alert('子窗口返回假!');
}
}
</script>
</HEAD>
<BODY>
<input id=button1 type=button value=Button name=button1 onclick="showmodal();">
</BODY>
</HTML>
2、child.htmlHtml代码 //child.html <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <TITLE></TITLE> <script language="javascript"> function trans(tag){ if (tag==0){ window.returnValue=false; } else{ window.returnValue =true; } window.close(); } </script> </HEAD> <BODY> <INPUT id=button1 type=button value="返回真" name=button1 onclick="trans(1)"> <INPUT id=button2 type=button value="返回假" name=button2 onclick="trans(0)"> </BODY> </HTML>
总结:
这样一来可以实现从模式窗口向父窗口传递值的作用,这个returnValue除了可以是布尔值,整型值等以外还可以是个js数组,用来传递大量数据。
- window.returnValue使用方法(转)
- window.returnValue使用方法
- window.returnValue使用方法
- window.returnValue使用方法
- window.returnValue使用方法
- window.returnValue使用方法
- window.returnValue使用方法
- window.returnValue和 window.showModalDialog()和window.close()的使用方法
- window.returnValue
- window.returnValue
- window.showModalDialog() + window.returnValue
- window.returnValue 用法
- window returnValue 数组
- window.returnValue的用法
- window.event.returnValue
- window.returnValue和window.showModalDialog
- window.event.returnValue=false
- 2013-12-11-window.returnvalue兼容性
- 尘世喧哗,给自己留一份沉默吧
- C++ 第十周任务-贪财的富翁
- 求1000以内所有偶数的和 (do while )
- 一个简单前端所用的知识及注意点(自动建立数据源、判断数据源是否正常连接、隐藏表等)
- Linux下send、sendto、sendmsg函数分析
- window.returnValue使用方法
- WordCount工作流程分析与总结
- 那些让人心痛的句子 还是记忆
- pecl 安装php 扩展时报错Cannot find config.m4.
- Windows下开机启动Tomcat配置
- java命令生成可执行的jar包
- 分数累加
- UIScrollView的touch事件特点
- 有些事情,我们本知道,却无需记得