Re: [請益] 將radio button值傳至text欄位
※ 引述《one0one (one0one)》之銘言:
: <input type="text" name="text1" value=""/>
: 我利用Radio button,請問要如何將所選定的m_id,即時傳入本頁面的text欄位中?
: 煩請高手幫忙解惑,感謝!!
你最後出現的HTML是類似下面的這樣嘛?
<input type="radio" name="m_id[]" value="value1"> value1
<input type="radio" name="m_id[]" value="value2"> value2
...
那麼 在每個input當中加
onClick="document.getElementById('textfield').value=this.value"
然後把那個text欄位加一個 id="textfield"
綠字可自行更換
--
其實是有個getElementsByName啦
但是我記得它傳回來的好像是個陣列 (因為name可以重覆)
而getElementById回傳的就是那個元件 (因為id不能重覆)
所以還是加個id好用些
--
'Oh, Harry, dont't you see?' Hermione breathed. 'If she could have done
one thing to make absolutely sure that every single person in this school
will read your interview, it was banning it!'
---'Harry Potter and the order of the phoenix', P513
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 192.192.197.115
推
05/06 21:30, , 1F
05/06 21:30, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):