㈠ 求助!!HTML源代碼!要求可以實現在線答題,且為多項選擇題的源碼!
你說的多項選擇題,我是不是可以理解成多選??
多選的實現是這樣的:回
第一答: 必須將多選框放到form裡面。
第二: 然後name屬性完全一樣,value不相同。這樣當你提交到Action中的時候,只需要使用request對象獲取toselect的值就行了。
第三: 獲取值:request.getParameterValues("toselect"),就會將選中的多選框裡面的value獲取,並且返回一個String[]數組,這個數組裡面就有你想要的值:即選中的值
<html>
<body>
<form>
<input type = "checkbox" value = "A" name = "toselect"/>A
<input type = "checkbox" value = "B" name = "toselect"/>B
<input type = "checkbox" value = "C" name = "toselect"/>C
<input type = "checkbox" value = "D" name = "toselect"/>D
</form>
</body>
</html>