第一步:html代码
<div class="mpgg">
<input type="checkbox"
name="boxes" id="boxes" class="mpg" value="src"/>11
<br/>
<input type="checkbox"
name="boxes" id="boxes" class="mpg" value="avi"/>222
<br/>
<input type="checkbox"
name="boxes" id="boxes" class="mpg" value="mov"/>33
<br/>
<input type="checkbox"
name="boxes" id="boxes" class="mpg" value="flv"/>44
<br/>
<input type="checkbox"
name="boxes" id="boxes" class="mpg" value="mp4"/>55
<br/>
</div>
<input type="button"
value="添加至购物车" onclick="addCart();"
/>
function addCart() {
createXMLHttpRequest();
var m =
document.getElementsByName('boxes');
var l =
m.length;
var boxes=""
;
var
j=0;
for ( var
i=0; i< l; i++){
if(m[i].checked){
j++;
}
}
if(j>0){
for ( var
i=0; i< l; i++){
if(m[i].checked){
boxes+=m[i].value+",";
}
}
var strings
= "docc.jsp?id=1" +
encodeURI("&boxes"+boxes);
}
function addCart() {
}