002 單選 checked

Post date: 2015/1/27 上午 03:27:05

onClick="chooseOne(this);"

var currentSelected = "";

function chooseOne(cb) {

if(currentSelected!="") currentSelected.checked = false;

if(cb.checked) currentSelected = cb;

else currentSelected="";

}