I would like to send the text value in html select box as a parameter to the mapped place Help me.

Asked 2 years ago, Updated 2 years ago, 78 views

<select name="account" onChange="getSelectValue(this.form);">
<option value="oms_acc" selected> Nonghyup 01024595877-09 (deposit box)
    : : XXX)</option>
<option value="ju_acc"> Our 237097-56-098331 (deposit: XXX)</option>
<option value="les_acc"> National 480-331-098356 (deposit: XX)</option>
<option value="smh_acc"> Hana 11259-27-1649782 (deposit box: XXX)</option>
</select>

<script>
var account = [ document.getElementByName("account").selelctedIndex ].text;
function getSelectValue(frm) {
    alert("changed");
    alert(account);
    account = [ document.getElementByName("account").selelctedIndex ].text;
    alert(account);
}
</script>

<a
href="contentBuy.do?id=<%=writeDTO.getM_id()%>&category=<%=name%>&seq=<%=writeDTO.getW_seq()%>&title=<%=writeDTO.getW_title()%>&price=<%=writeDTO.getW_price()%>&account="+"&{account};">Purchase</a>

When sending text values in the account select box (our 237097-56-098331 (deposit: XXX) or Kookmin 480-331-098356 (deposit: XXX) to the place where contentBuy.do has stamped, everything else goes well

account="+"&{account}; This is the only one that doesn't exceed the value,,,,,ㅜ Is there any other way?

html spring mvc

2022-09-21 19:53

1 Answers

The function is in the form getElementByName instead of getElementByName.

getElementsByName("account")[0].selectedIndex

Try changing it like above.


2022-09-21 19:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.