请教大家一个问题:
father.jsp:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><html>
<head>
<script language="javascript">
ReturnVal=window.showModalDialog("fileframe.jsp?filenames="+strFile); if (ReturnVal!=null)
{
document.getElementById("returnValue").value=ReturnVal;
}
</script>
</head>
<body>
This is my JSP page. <br>
<form id='test' action="son.jsp" method="post" target='_blank'>
<input type="textbox" id='returnValue'/>
<input type='submit' value='提交'>
</form>
</body>
</html>
son.jsp:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<script language="javascript">
function return()
{
var strReturn;
strReturn=document.getElementById("paraFiles").value;
window.returnValue =strReturn;
window.close();
}
</script>
</head>
<body>
<INPUT onclick="return()" type="button" value="返回">
</body>
</html>
这两端代码有问题,现在我想从father.jsp进入,然后弹出son.jsp,然后点击返回,我想将"返回",写到father.jsp的returnValue这个单行编辑框中,如何修改呢,谢谢大家了。
father.jsp:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><html>
<head>
<script language="javascript">
ReturnVal=window.showModalDialog("fileframe.jsp?filenames="+strFile); if (ReturnVal!=null)
{
document.getElementById("returnValue").value=ReturnVal;
}
</script>
</head>
<body>
This is my JSP page. <br>
<form id='test' action="son.jsp" method="post" target='_blank'>
<input type="textbox" id='returnValue'/>
<input type='submit' value='提交'>
</form>
</body>
</html>
son.jsp:<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<script language="javascript">
function return()
{
var strReturn;
strReturn=document.getElementById("paraFiles").value;
window.returnValue =strReturn;
window.close();
}
</script>
</head>
<body>
<INPUT onclick="return()" type="button" value="返回">
</body>
</html>
这两端代码有问题,现在我想从father.jsp进入,然后弹出son.jsp,然后点击返回,我想将"返回",写到father.jsp的returnValue这个单行编辑框中,如何修改呢,谢谢大家了。
function return()
{
var strReturn;
strReturn=document.getElementById("paraFiles").value;
parent.window.returnValue =strReturn;
window.close();
}
<head>
<script >
window.onload=function(){
ReturnVal=window.showModalDialog("2.html"); document.getElementById('aa').value=ReturnVal;}
</script>
</head>
<body>
This is my JSP page. <br>
<form name="form1" method="post" target='_blank'>
<input type="text" id='aa' name="txt1" value="">
<input type='submit' value='提交'>
</form>
</body>
</html> son.jsp: <html>
<head>
<script>
function return1()
{
var strReturn="aaaa";
window.returnValue =strReturn;
window.close();
}
</script>
</head>
<body>
<INPUT onclick="return1()" type="button" value="返回">
</body>
</html>
里面的
ReturnVal=window.showModalDialog("2.html");
document.getElementById('aa').value=ReturnVal;
一定要写在function 函数里面否则页面加载的时候 会找不到对象
或者你把<script> </script> 下载整个页面的下边,等页面加载完在调用2.son.jsp:
这里的function return() 不能用 return 因为这个名字是关键字。你用后会报错。其他都没问题了。
我测试的时候把页面 改成1.html 2.html了。粘贴没改过来。
自己改下就行。还有这句:<input type="textbox" id='returnValue'/> 应该是
<input type="text" id='returnValue' name="txt" value="" />这样写会好很多
{
window.open("123.html","newwindow","Height:400px; Width: 500px;Top: 100; Left: 100;
resizable: no; status: no;scroll:no");
} function inputAdvdFunKeyBlf_order(value)
{
document.getElementById("AdvdFunKeyBlf_order").value = value;
}
子窗口: function init()
{
AdvdFunKeyBlf_order_par = window.opener.document.getElementById("AdvdFunKeyBlf_order_child").value; for (i=0; i <4;i++)
AdvdFunKeyBlf_order_new[i] = AdvdFunKeyBlf_order_par.charAt(i);
……
} <body onLoad="init();">
……
<input id=uiViewApplyButton onClick=btnOKonclick() type=button value=Apply name="">
function btnOKonclick()
{
var value = AdvdFunKeyBlf_order_new; window.opener.inputAdvdFunKeyBlf_order(value);
window.close();
}
<html>
<head>
<script language="javascript">
function return()
{
var strReturn;
strReturn=document.getElementById("paraFiles").value;
window.returnValue =strReturn;
window.close();
}
</script>
</head>
<body>
<INPUT onclick="return()" type="button" value="返回">
</body>
</html>
版主你的代码本身就有问题的啊,你看看你的那个document.getElementById("paraFiles").value; 页面中没有这个字段的啊,不能取值的啊