09/10/2018, 17:42
Nhờ các bạn giúp đỡ gấp !
Bạn nào có cái java script để lấy các giá trị được chọn trong combo list (<select name="abc" multiple>.... </select>) thì cho mình xin với. Cảm ơn các bạn thật nhiều.
Bài liên quan
Thí dụ đây :
<FORM>
<SELECT NAME="liste" SIZE="1">
<OPTION SELECTED VALUE="">Choisissez</OPTION>
<OPTION VALUE="index.htm">Index</OPTION>
<OPTION VALUE="suscribe.htm">Inscription</OPTION>
<OPTION VALUE="aparaitr.htm">A paraître</OPTION>
</SELECT>
<INPUT TYPE="button" VALUE="Allez" onClick="if (form.liste.selectedIndex != 0) window.open(form.liste.options[form.liste.selectedIndex].value, 'Abonnement', 'scrollbars=yes,status=yes,width=500,height=300'); else alert('Veuillez faire un choix')">
</FORM>
Chúc thành công.
form.liste.options[form.liste.selectedIndex].value[i]
Vui lòng giúp em vấn đề này với nhé.
Cảm ơn anh thật nhiều.
Ví dụ script này lưu giá trị được chọn trong strValues.
phía trên dòng alert("Here are the values you've selected:\r\n" + strValues); | bạn nhập thêm một đoạn mã nhỏ nữa
document.frmGroup.mydata.value = strValues;
khi xử lý dữ liệu ở phía server ( mình chỉ bít php thui ) thì bạn đơn giản là request biến mydata từ $_POST hoặc $_GET , sau đó xài hàm explode() để "phá" chuỗi này ra thành 1 mảng và xử lý bình thường .