js ShowModalDialog向父窗口传参数
2013-06-16 15:25
176 查看
父窗口js代码
function openSelectReceiverUI(){
myShowModalDialog("URL地址", 500, 500);
}
表单
<s:hidden name="UserID" />
<s:textfield name="receiverName" cssClass=" required InputStyle" cssStyle="width:250px; float:left;" cssClass="required "/>
<div onClick="openSelectReceiverUI()" class="FuncBtn" style="margin-left: 10px;">
<div class="FuncBtnHead"></div>
<div class="FuncBtnMemo">选择...</div>
<div class="FuncBtnTail"></div>
</div>
对超链接的美化
.FuncBtnHead {
background: url(images/func_btn_head_bg.gif) no-repeat;
float: left;
width: 2px;
height: 20px;
}
.FuncBtnMemo {
background: url(images/func_btn_bg.gif) repeat-x;
float: left;
height: 20px;
padding-top: 4px;
padding-left: 8px;
padding-right: 8px;
}
.FuncBtnTail {
background: url(images/func_btn_tail_bg.gif) no-repeat;
float: left;
width: 2px;
height: 20px;
}
子窗口
<script type="text/javascript">
function selectMe( id, name ){
var win = window.dialogArguments;
win.document.forms[0].UserID.value = id;
win.document.forms[0].receiverName.value = name;
window.close();
}
</script>
<a href="javascript:selectMe('参数1', '参数2')">
最后 父窗口需要的js代码
function myShowModalDialog(url, width, height) {
var arguments = window;
if (!width) width = 350;
if (!height) height = 350;
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
var features = "" //
// + "dialogLeft:" + left + ";"// 左边距
// + "dialogTop:" + top + ";"// 上连距
+ "dialogWidth:" + width + "px;"// 宽度
+ "dialogHeight:" + height + "px;"// 高度
+ "center: yes;"// 是否居中
+ "resizable: yes;"// 是否可以改变大小
+ "scroll: yes;"// 当内容超过窗口大小时是否显示滚动条
+ "status: yes;"// 是否显示状态栏
window.showModalDialog(url, arguments, features);
}
function openSelectReceiverUI(){
myShowModalDialog("URL地址", 500, 500);
}
表单
<s:hidden name="UserID" />
<s:textfield name="receiverName" cssClass=" required InputStyle" cssStyle="width:250px; float:left;" cssClass="required "/>
<div onClick="openSelectReceiverUI()" class="FuncBtn" style="margin-left: 10px;">
<div class="FuncBtnHead"></div>
<div class="FuncBtnMemo">选择...</div>
<div class="FuncBtnTail"></div>
</div>
对超链接的美化
.FuncBtnHead {
background: url(images/func_btn_head_bg.gif) no-repeat;
float: left;
width: 2px;
height: 20px;
}
.FuncBtnMemo {
background: url(images/func_btn_bg.gif) repeat-x;
float: left;
height: 20px;
padding-top: 4px;
padding-left: 8px;
padding-right: 8px;
}
.FuncBtnTail {
background: url(images/func_btn_tail_bg.gif) no-repeat;
float: left;
width: 2px;
height: 20px;
}
子窗口
<script type="text/javascript">
function selectMe( id, name ){
var win = window.dialogArguments;
win.document.forms[0].UserID.value = id;
win.document.forms[0].receiverName.value = name;
window.close();
}
</script>
<a href="javascript:selectMe('参数1', '参数2')">
最后 父窗口需要的js代码
function myShowModalDialog(url, width, height) {
var arguments = window;
if (!width) width = 350;
if (!height) height = 350;
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
var features = "" //
// + "dialogLeft:" + left + ";"// 左边距
// + "dialogTop:" + top + ";"// 上连距
+ "dialogWidth:" + width + "px;"// 宽度
+ "dialogHeight:" + height + "px;"// 高度
+ "center: yes;"// 是否居中
+ "resizable: yes;"// 是否可以改变大小
+ "scroll: yes;"// 当内容超过窗口大小时是否显示滚动条
+ "status: yes;"// 是否显示状态栏
window.showModalDialog(url, arguments, features);
}
相关文章推荐
- HyperLink 打开新窗口传递参数
- 批处理START打开窗口程序的参数详细介绍
- javascript实现浏览器窗口传递参数
- javascript弹出窗口 window.open使用方法以及参数说明分析篇
- 使用StartupInfo的参数设置窗口的启动位置的大小
- js获取或设置当前窗口url参数的小例子
- 2.2 窗口屏幕参数及UI样式---Display 和Style
- linux resize命令参数及用法详解--linux设置终端窗口大小命令
- JS实现制作弹出小窗口并获取参数值1(用JS制作9种弹出小窗口(HTML))
- win32窗口参数
- stucts2 &lt;s:a&gt;&lt;/s:a&gt; 中在新窗口中打开是什么参数啊!
- 弹出窗口参数
- JS 弹出新窗口,在新窗口获取传过来的参数
- 向窗口传递多个参数
- 父窗口和iframe子窗口之间相互传递参数和调用函数或方法
- 点击 VB 中 DataGrid 行 触发事件 弹出窗口 并传递 所点击行参数
- WPF 之 窗口间传参数
- 第二十九节:数码管通过切换窗口来设置参数,并且不显示为0的高位。
- PB窗口之间传递多参数的方法
- PB窗口之间传递多参数的方法