脚本之家精简使用版本,一般情况好多cms都有一些这样的函数。dedecms中的选择相关文章也是用的这样的函数。下面给出具体的代码。
父页面核心代码:
代码如下:
输出选择的id
代码如下:
href="javascript:selAll()">全选 href="javascript:noSelAll()">取消 href="javascript:ReturnValue()">把选定值加到列表
一下是补充:
//模式窗体传值
代码如下:
弹出窗口内录入数据确定后返回给父窗体--主窗体
function doInput()
{
var win = window.showModalDialog("Childform.html",window,"dialogWidth=500px;dialogHeight=300px;center=yes;status=no");
if(win != null)
{
document.getElementById("parentTextBox").value = win;
}
}
script>
在新弹出的窗体里输入数据,传输到父窗体.
点这里弹出子窗体
代码如下:
弹出窗口内录入数据确定后返回给父窗体--子窗体 点这里返回
document.getElementById("childTextBox").value = window.dialogArguments.document.getElementById("parentTextBox").value;
function doPassToParent()
{
if(document.getElementById("childTextBox").value.length <=0)
{
alert("请填写数据");
return;
}
window.returnValue = document.getElementById("childTextBox").value;
window.close();
}
script>
//子窗体和父窗体传值
1.新建两个页面 一个是 Parent.html
代码如下:
父窗体 function OpenWindow(){
window.open('son.html');
}
function setValue(m_strValue){
document.getElementById("txt_Value").value = m_strValue;
}
script>
另一个是子窗体 :
代码如下:
子窗体 function CloseWind(){
opener.setValue("传值到父窗体");
window.close();
}
script>
2.通过子窗体执行的父窗体的setValue(m_strValue)来执行赋值操作.
下载本文