用Javascript写就可以了!
代码:
<html>
<head>
<script languange="javascript">
function buy()
{
var s="";
//如果被选中,则累计被选中的商品名称(通过字符串相连 )
if(document.myform.checkbox1.checked==true)
s=s+document.myform.checkbox1.value+"\n";
if(document.myform.checkbox2.checked==true)
s=s+document.myform.checkbox2.value+"\n";
if(document.myform.checkbox3.checked==true)
s=s+document.myform.checkbox3.value+"\n";
if(document.myform.checkbox4.checked==true)
s=s+document.myform.checkbox4.value+"\n";
if(document.myform.myradio[0].checked==true)
{
if(confirm("您准备买进以下物品,确定吗?:\n"+s)==true)
document.write("您买进了以下物品:<pre>"+s+"</pre>");
}
else
{
if(confirm("您准备卖出以下物品,确定吗?:\n"+s)==true)
document.write("您卖出了以下物品:<pre>"+s+"</pre>");
}
}
</script>
<META http-equiv="Content-type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
input
{
font-size:15px;
border:1px solid;
}
body
{
background-color:#8ad3ff;
}
#Layer1 {
position:absolute;
left:199px;
top:278px;
width:67px;
height:26px;
z-index:1;
}
-->
</style>
</head>
<title>购买商品的复选框</title>
<body>
<center>
<form name="myform">
<h2>推荐物品橱窗专区</h2>
<table width="587" height="201" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="160" height="118"><img src="10.jpg" width="160" height="120" ></td>
<td width="172"><img src="11.jpg" width="160" height="120" ></td>
<td width="157"><img src="12.jpg" width="160" height="120" ></td>
<td width="93"><img src="13.jpg" width="160" height="120" ></td>
</tr>
<tr>
<td height="31"><div align="center">688.00元</div></td>
<td><div align="center">1002.50元</div></td>
<td><div align="center">1000.00元</div></td>
<td><div align="center">750.00元</div></td>
</tr>
<tr>
<td height="23"><input name="checkbox1" type="checkbox" id="checkbox1"value="国服魔兽金币">
国服魔兽金币</td>
<td><label>
<input name="checkbox2" type="checkbox" id="checkbox2" value="魔兽争霸种族外挂">
魔兽争霸种族外挂</label></td>
<td><label>
<input name="checkbox3" type="checkbox" id="checkbox3" value="魔兽争霸典藏攻略">
魔兽争霸典藏攻略</label></td>
<td><label>
<input name="checkbox4" type="checkbox" id="checkbox4" value="⊙⊙⊙魔兽世界">
⊙⊙⊙魔兽世界</label></td>
</tr>
<tr>
<td height="27"><div align="center">
<label>
<input type="reset" name="Submit" value="重选">
</label>
</div></td>
<td><div align="center">您是:
<label>
<input name="myradio" type="radio" value="买家">
买家</label>
</div></td>
<td><div align="center">
<label>
<input type="radio" name="myradio" value="卖家">
卖家</label>
</div></td>
<td><div align="center">
<label>
<input type="button" name="Submit2" value="成交>>" onClick="buy()">
</label>
</div></td>
</tr>
</table>
</form>
</center>
</body>
</html>