注册 登录
编程论坛 ASP技术论坛

[求助]点击文本框,弹出新页面,选取所需的值传给文本框

chenbofeng20 发布于 2009-10-15 09:55, 1053 次点击
点击文本框后弹出一个新的页面,在该页面选取值后再在文本框内显示。
8 回复
#2
aspic2009-10-15 10:31
弹出模式对话框 然后赋值到父窗口的文本框
#3
aspic2009-10-15 10:40
程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
 
<body>
<form name="f">
<input type="text" name="a" id="a" onclick="window.open('b.html')" />
</form>
</body>
</html>
弹出页面
程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
 
<body>
<span onclick="window.opener.document.f.a.value = this.innerHTML">我是弹出页面的值</span>
</body>
</html>
#4
chenbofeng202009-10-16 09:52
回复 3楼 aspic
非常感谢你的帮助!!
#5
xpowoow2009-10-17 00:00
用ajax,问题变得更简单。
#6
xpowoow2009-10-17 00:04
不建议用页面窗口,用模态窗口。。。。点击模态窗口,关闭回调值赋给文本框,可能达到你最完美的结果。
#7
xpowoow2009-10-17 00:16
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
 
<body>
 
  <label>
  <textarea name="advice"  cols="70" rows="5" id="advice" ondblclick="M_show();">sdasd</textarea>
  </label>
 
</body>
</html>
<script language="javascript" type="text/javascript">
function M_show(){
var advice=document.getElementById('advice').value;
var retvalue=window.showModalDialog("showModalDialog_target.asp", "传值窗口","status:false;dialogWidth:600px;dialogHeight:400px");
if (retvalue!="" && typeof(retvalue)!="undefined"){
advice+=retvalue;
document.getElementById('advice').value=advice;
}
}
</script>
#8
xpowoow2009-10-17 00:16
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn001.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
 
<body>
<table width="582" border="1">
  <tr>
    <td width="175">机构名称</td>
    <td width="202">机构电话</td>
    <td width="183">机构职能</td>
  </tr>
  <%
  dim  sql
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from jigou order by jigou_id desc"
  rs.open sql,conn,1,3
  if not rs.eof then
 For i=0 to rs.recordcount-1
  %>
  <tr ondblclick="returnval('<%=rs("jigou_name")%>');">
    <td ><%=rs("jigou_name")%>&nbsp;</td>
    <td><%=rs("jigou_tel")%>&nbsp;</td>
    <td><%=rs("jigou_zhineng")%>&nbsp;</td>
  </tr>
  <%  
  rs.movenext
  next
  else
  response.write "没有数据!"
  end if
  %>
   
   
</table>
</body>
</html>
 
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<script language="javascript" type="text/javascript">
var backvalue='';
function returnval(backvalue){
if(typeof(backvalue)!="undefined"){
window.returnValue=backvalue;
window.close();
}
}
</script>
#9
xpowoow2009-10-17 00:19
注意两页的JS就是你要的结果了。长话短说.
1