Re: [請益] 將radio button值傳至text欄位

看板Web_Design作者 (ha(ruhi|yate)ism)時間17年前 (2007/05/06 15:04), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《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
document.getElementByName('m_id[]')[數字] 陣列
05/06 21:30, 1F
文章代碼(AID): #16FNtaqb (Web_Design)
文章代碼(AID): #16FNtaqb (Web_Design)