var s = 1
function jisuan(){
var m = document.getElementsByTagName("input")
for(var i=1i<m.lengthi++){
if(m[i].type=="checkbox" &&s%2==1){
m[i].checked = true
}else{
m[i].checked = false
}
}
s++
}
</script>
<input type="checkbox" onclick="jisuan()" /><br />
<form action="你要提交的地址">
<input type="checkbox" name="pic[]" />
<input type="checkbox" name="pic[]" />
<input type="checkbox" name="pic[]" />
<input type="checkbox" name="pic[]" />
<input type="checkbox" name="pic[]" />
</form>
这跟是不是相册没有关系吧,把图片的地址、名字或者ID赋值给checkbox的value都可以啊
<!doctype html><html>
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<script src="jquery-3.1.1.min.js"></script>
</head>
<body>
<h3>请选择图片文件:JPG/GIF</h3>
<form name="form0" id="form0" >
<input type="file" name="file0" id="file0" multiple="multiple" />
<br><br><img src="" id="img0" width="120">
</form>
</body>
<script>
$("#file0").change(function(){
var objUrl = getObjectURL(this.files[0])
console.log("objUrl = "+objUrl)
if (objUrl)
{
$("#img0").attr("src", objUrl)
$("#img0").removeClass("hide")
}
})
//建立一个可存取到该file的url
function getObjectURL(file)
{
var url = null
if (window.createObjectURL!=undefined)
{ // basic
url = window.createObjectURL(file)
}
else if (window.URL!=undefined)
{
// mozilla(firefox)
url = window.URL.createObjectURL(file)
}
else if (window.webkitURL!=undefined) {
// webkit or chrome
url = window.webkitURL.createObjectURL(file)
}
return url
}
$('input').on('change',function(){
var value = $(this).val()
value = value.split("\\")[2]
alert(value)
})
</script>
</html>