*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% Arial, Helvetica, sans-serif, "新宋体";}
.demo{width:340px;margin:0 auto;}
.c{width:100px;height:25px;line-height:25px;text-align:center;border:1px solid #eee;margin:5px;float:left;font-size:12px;cursor:pointer}
function $(id){
return document.getElementById(id);
};
var x=["菜单导航","时间日期","焦点图","tab标签","jquery特效","在线客服","17素材","js代码"];
var y=[];
for(var i=0,m=x.length;i
$('c' + i).onclick = (function(i){
return function(){
//alert(i);
// 判断数组y中是否存在数组x下标i所对应的值,若是没有则为-1
var s = y.join().indexOf(x[i]);
if(s>=0){
//alert(s);
for(var j in y){
// 判断数组y下标对应值与数组x下标对应值
if(y[j] == x[i]){
// 删除数组y中第j个对应值
y.splice(j,1);
}
}
}else{
//alert(s);
y.push(x[i]);
}
$('i').value = y.join(' ');
}
})(i);
}