javascript 代码
<html><head>
<script type="text/javascript">
function createOrder()
{
tea=document.forms[0].tea
txt=""
for (i=0;i<tea.length;++ i)
{
if (tea[i].checked)
{
txt=txt + tea[i].value + " "
}
}
document.getElementById("order").value="你点了一杯" + txt
}
</script>
</head>
<body>
<p>你要喝什么:</p>
<form>
<input type="checkbox" name="tea" value="龙井">龙井<br />
<input type="checkbox" name="tea" value="大红袍">大红袍<br />
<br />
<input type="button" onclick="createOrder()" value="确定">
<br /><br />
<input type="text" id="order" size="50">
</form>
</body>
</html>