$(function() {
$("# value").click(function() {
var value = $("input[name='sex']:checked").val();
alert(" var==[" + value+"]");
});
$("# ").click(function() {
if ($("input[name='play']:checkbox:checked").length == 0) {
alert(" !");
return false;
}
var v = '';
$("input[name='play']:checkbox:checked").each(function() {
v += $(this).val() + ',';
});
alert(v.substring(0, v.length - 2));
});
// ,
$("#chk_all").click(function() {
if ($("#chk_all").is(':checked')) {
$("[name='play']").attr('checked', 'true');
$("[name='chk_all']").attr('checked', 'true');
} else {
$("[name='play']").removeAttr('checked');
$("[name='chk_all']").removeAttr('checked');
}
});
//
$("# ").click(function() {
$("[name='play']").attr('checked', 'true');
});
//
$("# ").click(function() {
$("[name='play']").removeAttr('checked');
});
//
$("# ").click(function() {
$("input[name='play']").each(function() {
if (this.checked) {
this.checked = false;
} else {
this.checked = true;
}
});
});
// select
$("# ").click(
function() {
var cityname = window.prompt(" :");
/*
k = k.replace(new RegExp(",","gm"), "");// “ ,”
k = k.replace(/(^\s*)/g, ""); //
k = k.replace(/(\s*$)/g, ""); //
k = k.replace(/(^\s*)|(\s*$)/g, ""); // , 2 。
*/
if(cityname.replace(/(^\s*)|(\s*$)/g, "").length!=0){
$("<option value=" + cityname + ">" + cityname + "</option>")
.appendTo("#city");
}
});
})