如果只是输入一些信息,用javascript中的prompt应该可以吧。如果一定要一个页面的话,你只有A->B->A也就是要刷新A页因为A页面显示完后,就是一个静态页面,在不刷新时只能用javascript来控制
解决方案 »
- jsp取不到输入的值
- 怎么将select标签设置成和数据库中一样的/
- 急急急!!!为什么我的Eclipse不认识servlet?
- 时间的类型
- 怎样通过hibernate修改某个字段的值呢?
- 用过Jfreechart的请过来看看..
- 类似csdn论坛的树怎么实现用jsp?
- 关于struts2的一些问题, 求高手求教
- Result set type is TYPE_FORWARD_ONLY是什么错误?????在线等~~~
- Spring MVC问题,类SimpleFormController在哪个jar包中,以及应import哪个package
- 请问一个JSP配置的问题,我现在系统上装了Jbuilder6.0 ,dreamweaver,操作系统是2000 server,我如何在Dreamweaver中用JSP来做网页?
- 文件上传
在"选择人员"的onclick="msg()"
function msg()
{
var str
str=window.showModalDialog("select.jsp")//str为返回的值
document.form1.name.value=str//把得到的给name
}
在select.jsp中
function ok()
{var b="" b=document.form1.select2.value
//b=document.form1.select2.text window.returnValue=b
window.close()
}
function cancel()
{window.returnValue=""
window.close()}
<input type="button" name="gg" value="确定" onclick="ok()">
 
<input type="button" name="can" value="取消" onclick="cancel()">
1 打开模态窗口,获取返回值,用脚本填充主窗口相关域。优点:窗口联系层次分明,缺点:跳转翻页等实现起来痛苦,返回值只能是一个字符串,对于回填多个域要另做字符串的合并与拆解实现。
2 打开非模态窗口,在子窗口关闭前,直接用window.opener来引用源窗口的域并填充值。优点:实现翻页,跳转非常方便,无需特别控制。而且易填充多个域。缺点:与源窗口的联系相对弱,一旦用户切换源窗口控制难。举例:parent.html中的中有一form,其中dept栏须用帮助窗口来辅助输入。用两个按钮分别来演示模态窗口实现和非模态窗口实现:
<!--parent.html-->
<html>
<head>
<script>
function getForce(){
var sRtn
sRtn = window.showModalDialog("help1.html")
form1.dept.value=sRtn
}
function getFree(){
window.open("help2.html")
}
</script>
</head>
<body>
<form name="form1">
请输入部门名称:<input value="" readonly name="dept" type="text" >
<br>
<input type=button name="强制输入" value="force" onclick="getForce()">
<input type=button name="自由输入" value="free" onclick="getFree()">
</form></body>
<html><!--help1.html-->
<html>
<head>
<script>
function returnWithValue(s){
window.returnValue=s
window.close()
}
</script>
</head>
<body>
<table>
<tr bgcolor='#cccccc'>
<td>编码</td>
<td>单位名称</td>
</tr>
<tr onclick="tmp.value='单位1'" ondblclick="this.onclick;ok.click()">
<td>111</td>
<td>单位1</td>
</tr>
<tr onclick="tmp.value='单位2'" ondblclick="this.onclick;ok.click()">
<td>222</td>
<td>单位2</td>
</tr>
</table>
<input type="hidden" value="" name="tmp"><input type=button name="ok" value="确定" onclick="returnWithValue(tmp.value)">
<input type=button name="cancel" value="取消" onclick="returnWithValue('')">
</form></body>
<html>
<!--help2.html-->
<html>
<head>
<script>
function returnWithValue(s){
var winSource= window.opener
winSource.form1.dept.value=s
window.close()
}
</script>
</head><body><table>
<tr bgcolor='#cccccc'>
<td>编码</td>
<td>单位名称</td>
</tr>
<tr onclick="tmp.value='单位1'" ondblclick="this.onclick;ok.click()">
<td>111</td>
<td>单位1</td>
</tr>
<tr onclick="tmp.value='单位2'" ondblclick="this.onclick;ok.click()">
<td>222</td>
<td>单位2</td>
</tr>
</table>
<input type="hidden" value="" name="tmp"><input type=button name="ok" value="确定" onclick="returnWithValue(tmp.value)">
<input type=button name="cancel" value="取消" onclick="returnWithValue('')">
</body>
<html>