求助!!HTML源代码!要求可以实现在线答题,且为多项选择题的源码!

求助!!HTML源代码!要求可以实现在线答题,且为多项选择题的源码!,第1张

你说的多项选择题,我是不是可以理解成多选??

多选的实现是这样的:

第一: 必须将多选框放到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>

html中写个form表单。这个简单。但是你的选择题是页面上写死的。还是从数据库里面取的?提交后判断对错你是要转后台处理还是页面上js直接校验?而且不论怎样,也不是html就能搞定的吧。

文件名为temperature-conversion.html的代码如下

<!DOCTYPE html>

<html>

<head>

<h1 style="color:redfont-size:32px">Temperature Conversions</h1>

<br/>

</head>

<body>

Author: CHEN Da Wen<br/>

Student ID: 123456789d<br/>

<br/>

<b>Use this form to convert celsius temperatures to fahrenheit:</b><br/>

<br/>

<table>

<form name="converter" action="temperature-converter.php" method="post">

<tr><td>Starting temperature(Celsius):</td>

<td><input type="text" name="start" value=""/></td></tr>

<tr><td>Ending temperature(Celsius):</td>

<td><input type="text" name="end" value=""/></td></tr>

<tr><td>Increment value:</td>

<td><input style="width:100px" type="text" name="increment" value=""/></td></tr>

<tr><td colspan=2>&nbsp</td></tr>

<tr><td colspan=2><input type="button" name="conversion" value="Display Conversion Table" onclick="converter.submit()"/>

<input type="button" name="clear" value="Clear" onclick="converter.reset()"/></td></tr>

</form>

</table>

</body>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/7043769.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-01
下一篇 2023-04-01

发表评论

登录后才能评论

评论列表(0条)

保存