作者bennylu (Benny)
看板Web_Design
标题Re: [问题] JavaScript一问
时间Wed Oct 4 17:46:28 2006
※ 引述《banco (Acoustic)》之铭言:
: 我现在有两个页面 A 跟 B
: A 页面当中有一个链结 <A> I, anchor </A>
: 现在我想要的功能是按了这个链结之後
: "I, anchor" 这串文字会直接贴在 B 页面中一个已经 focus 的 input text 当中
: 这一部份 JavaScript 该怎麽完成呢?
a.htm :
<input type="button" value="open window" onclick="b=window.open('b.htm');" />
<br />
<input type="button" value="I, anchor" onclick="doPaste()" />
<script>
function doPaste(){
pos = window.b.document.getElementById('b0').value;
window.b.document.getElementById(pos).value='paste';
}
</script>
b.htm :
focus on any one of them<br />
<input type="hidden" id="b0" value="b1" />
<input type="text" id="b1"
onclick="document.getElementById('b0').value=this.id" /><br />
<input type="text" id="b2"
onclick="document.getElementById('b0').value=this.id" /><br />
<input type="text" id="b3"
onclick="document.getElementById('b0').value=this.id" />
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.162.201.228
※ 编辑: bennylu 来自: 218.162.201.228 (10/04 17:48)
1F:推 terrybob:感谢,推~~~~ 10/04 18:07