正是爲題介紹。多個輸入更新多個文字區域的
我想我1套6/7輸入字段,以便能夠以更新不同的模板4/5不同的textareas從與輸入元素複製粘貼。使用getElementsByClassName方法
香港專業教育學院嘗試,但它似乎與多個文本域工作。
的多個輸入更新多個文本區域的一個簡單的例子就足以玩。
這是我到目前爲止,它的不完整。
1 name: <input type="text" name="1stTarget" onblur="tst1(this);" /><br />
2 name: <input type="text" name="2ndTarget" onblur="tst1(this);" /><br />
Email address: <input type="text" name="3rdTarget" onblur="tst1(this);" /><br />
Phone #: <input type="text" name="4thTarget" onblur="tst1(this);" /><br />
Schedule: <input type="text" name="5thTarget" onblur="tst1(this);" /><br />
<textarea name="result" id="result1" onClick="this.select();" class="disable">Hello 1stTarget, 2ndTarget i would like to confirm your email address 3rdTarget and phone # 4thTarget and the time you will be at work 5thTarget</textarea>
<br />
<textarea name="result2" id="result2" onClick="this.select();" class="disable">1stTarget and 2ndTarget updated their 5thTarget and their 4thTarget including their 3rdTarget</textarea><input type="reset" value="Reset!" />
使用
<script type="text/javascript">
function tst1(elm){
var trgt=document.getElementById('result1');
trgt.value=trgt.value.replace(elm.getAttribute('name'), elm.value);
}
</script>
請發表您的代碼。 – user2182349
請顯示一些代碼,你能解釋一下你正在嘗試做什麼嗎?你想要一個輸入來更新textareas,但更新textareas到什麼? – Chanckjh
對不起,這個網站是新手。沒有意識到我可以。 – KyleH8CH