日期:2014-05-16 浏览次数:20636 次
<div id="div_for_checkbox">
<input type='checkbox' value="male" title="male" onclick="callCheck(this)">
<a onclick="linkDetail('man')" style="cursor:hand">man</a>
</div>
$.ajax({
url:"php/selectdata.php",
type:"post",
dataType:"json",
success:function(data){
var select = document.getElementById("div_for_checkbox");
for(var name in data.sex){
var option = document.createElement("input");
option.type = "checkbox";
option.value = data.sex[name];
option.title = data.sex[name];
select.appendChild(option);
var a = document.createElement("a");
a.text = data.sex[name];
a.style="cursor:hand";
option.appendChild(a);
}
}
});
$.ajax({
url:"php/selectdata.php",
type:"post",
dataType:"json",
success:function(data){
for(var name in data.sex){
$("#div_for_checkbox").append('<input type="checkbox" value="'+data.sex[name]+'" title="'+data.sex[name]+'" onclick="callCheck(this)"><a onclick="linkDetail(\''+data.sex[name]+'\')" style="cursor:hand">'+data.sex[name]+'</a>');