关于使用javascript实现点击一个页面文本框,然后跳转到另一个页面进行点击值回传例子
d.jsp
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
</head>
<script type="text/javascript">
function openMyWindow() {
ret = window.showModalDialog('c.jsp', '', 'width=200,height=100');
if (ret != null)
{
window.document.getElementById("txt1").value = ret;
}
}
</script>
<body>
<input type="text" id="txt1" onclick="javascript:openMyWindow();"/>
</body>
</html>
c.jsp
<%@ page language="java" contentType="text/html; charset=gbk"
pageEncoding="gbk"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>注册</title>
<head>
<script language="JavaScript" type="text/javascript">
function backtest(a) {
window.returnValue=a;
window.close();
}
</script>
</head>
<body>
<a onclick="javascript:backtest('天津)">天津</a>
</body>
</html>