推 terrybob:感謝,推~~~~ 10/04 18:07
※ 引述《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)