比如说我在A页面中有一个表格,里面是一些信息
然后有一个“添加”的按钮
点击这个按钮以后,回打开B页面,也就是一个弹出页面
在B中有一些填空,对于A页面中的表格项
在B中填好以后,B自动关闭,在A中可以添加一行,显示刚才在B中输入的内容我主要不明白怎么才能让页面A接受到B的这个ACTION,请各位达人救救小弟~~
然后有一个“添加”的按钮
点击这个按钮以后,回打开B页面,也就是一个弹出页面
在B中有一些填空,对于A页面中的表格项
在B中填好以后,B自动关闭,在A中可以添加一行,显示刚才在B中输入的内容我主要不明白怎么才能让页面A接受到B的这个ACTION,请各位达人救救小弟~~
huantianxidi(欢天喜地) 请详细一点讲一下可以吗?
拜谢了~~
window.opener.form1.text1.value=document.form2.text2.value
把B中text2的值付给A的text1
但是是不是肯定是FORM1和FORM2呢?
我是不是需要给他们定一个ID或者NAME来让脚本定位呢?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis" />
<title>Untitled Document</title>
<script>
function open_win() {
window.open("2.html");
}
</script>
</head><body>
<form id="form1" name="form1" method="post" action="">
<input type="text" name="textfield" /> <input type="button" name="Submit" value="Submit" onclick="open_win()"/>
</form>
</body>
</html>
2.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis" />
<title>Untitled Document</title>
<script>
function testValue() {
window.opener.form1.textfield.value = document.form2.textfield.value;
window.close();
}
</script>
</head><body>
<form name="form2">
<input type="text" name="textfield" />
<input type="button" name="Submit" value="Submit" onclick="testValue()"/>
</form>
</body>
</html>
我都试过啦,好用,记得散分
这加到B的子页面,可以把子页面的值往父页面也就是B传B页面里这样写
function insert()
{
var r = "";
if((form1.para1.value) != "xxxx(自己定)"){
r = form1.para1.value;
window.returnValue = r;
window.close ();
}
else{
alert("无参数");
}
}
<input type="button" value="插入" onclick= "insert()">
那么点插入按钮的时候这个参数就传到A了。
A里面这么写,接受B传回来的参数:
function InsertB(){
var b;
var b,OutString;
b = window.showModalDialog("b.htm", "", "dialogHeight: 160px; dialogWidth: 500px; dialogTop: 200px; dialogLeft: 200px; help: no; resizable: 1; status: 0");
if (b != null){
OutString = "<IMG SRC='";
OutString += b + "'>";
window.frames (IFrameObject.name).focus();
MyRangeObject = window.frames(IFrameObject.name).document.selection.createRange ();
MyRangeObject.pasteHTML(OutString);
if((document.form3.b.value==null) ||(document.form3.b.value == "")){
document.form3.b.value = b;
}
else{
document.form3.b.value += ";" + b;
}
}
}
楼主明白?