javascrip 在页面2我想通过点击姓名来获得该姓名的职业,并返回到页面1表单的text中,请问用javascrip怎样实现???对javascrip不是很了解,望解决..... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 IE 中Page1<html><head><title>Page1</title><script language="javascript" type="text/javascript">var btnGet = null;window.onload = function (){ btnGet = document.getElementById("btnGet"); btnGet.attachEvent("onclick", getJob);}function getJob(){ window.open("page2.htm", "_blank", "width:100px, height:100px");}</script></head><body>职位<input type="text" id="txtJob" /><input type="button" id="btnGet" value="获取职位"/></body></html>Page2<html><head><title>Page2</title><script language="javascript" type="text/javascript">function returnJob(job){ window.opener.txtJob.value = job; window.close(); }</script></head><body><a href="#" id="name1" onclick="returnJob('SoftWare Engineer')">Name1</a>SoftWare Engineer<br /><a href="#" id="name2" onclick="returnJob('Designer')">Name2</a>Designer</body></html> 你说的情况可以实现依你所说,我估计页面2是页面1的打开(弹出)窗口我做了个例子,希望对lz有帮助(IE测试通过)://a.html<html><head><title>test</title><script>function show(){var name=window.showModalDialog("b.html");document.getElementById("txt1").value=name;}</script></head><body><input type=button value="打开窗口2" onclick=show()><input type=text id=txt1 value=""></body></html>//b.html<html><head><title>请选择人员</title><script>function a(obj){returnValue=obj.value;window.close();}</script></head><body><input type=button value="张三" onclick=a(this)><input type=button value="李四" onclick=a(this)></body></html>事例操作说明:将2个页面文件保存在同一个目录下(任意目录),打开页面a.html,点击按钮弹出页面b.html,选择人员点击,你将看到在a.html中的text中出现相应的人员姓名.lz说的是"职业",我也不知道你在页面里面怎么存放数据的,你稍微修改下应该就可以用了如果还有问题再提 浏览器文本框自动补全的内容是保存在哪里,如何获取 jquery选择器的一个小题目 用户名正则验证,找了两天了,没有正解! 如何用键盘的上下方向键,选择表格的行 插件svgview的guid 怎么提取啊? 有关复数form传递数据的问题 各路好汉请进,帮偶看一问题共200分 怎样问题在水平和垂直滚动后总保持div的位置在屏幕看得见的最左边和中间(因为有时滚动不一定是滚动到最左边) jq实现表格里面一行背景颜色闪动 JavaScript的try..catch在手机浏览器中出错? 奇怪的问题,大虾帮帮忙吧 高分求解```网页元素获取问题```高手请进
<html>
<head>
<title>Page1</title>
<script language="javascript" type="text/javascript">
var btnGet = null;
window.onload = function (){
btnGet = document.getElementById("btnGet");
btnGet.attachEvent("onclick", getJob);
}function getJob()
{
window.open("page2.htm", "_blank", "width:100px, height:100px");
}
</script>
</head>
<body>
职位<input type="text" id="txtJob" />
<input type="button" id="btnGet" value="获取职位"/>
</body>
</html>Page2
<html>
<head>
<title>Page2</title>
<script language="javascript" type="text/javascript">
function returnJob(job)
{
window.opener.txtJob.value = job;
window.close();
}
</script>
</head>
<body>
<a href="#" id="name1" onclick="returnJob('SoftWare Engineer')">Name1</a>SoftWare Engineer
<br />
<a href="#" id="name2" onclick="returnJob('Designer')">Name2</a>Designer
</body>
</html>
依你所说,我估计页面2是页面1的打开(弹出)窗口我做了个例子,希望对lz有帮助(IE测试通过)://a.html
<html>
<head>
<title>test</title>
<script>
function show(){
var name=window.showModalDialog("b.html");
document.getElementById("txt1").value=name;
}
</script>
</head>
<body>
<input type=button value="打开窗口2" onclick=show()>
<input type=text id=txt1 value="">
</body>
</html>//b.html
<html>
<head>
<title>请选择人员</title>
<script>
function a(obj){
returnValue=obj.value;
window.close();
}
</script>
</head>
<body>
<input type=button value="张三" onclick=a(this)>
<input type=button value="李四" onclick=a(this)>
</body>
</html>事例操作说明:将2个页面文件保存在同一个目录下(任意目录),打开页面a.html,点击按钮弹出页面b.html,选择人员点击,你将看到在a.html中的text中出现相应的人员姓名.lz说的是"职业",我也不知道你在页面里面怎么存放数据的,你稍微修改下应该就可以用了
如果还有问题再提