无标题页$(function() {
createCode("2431",5)
})
$("td").click(function() {
$(this).addClass("black");
});functioncreateCode(code, size) {varhtml='
html+='
';html+=createElement(code.charAt(i), size);
html+='
'}html+='
';vardiv=document.createElement('div');div.innerHTML=html;
document.body.appendChild(div);
}functioncreateElement(n, size) {varnode=__list[parseInt(n)];varhtml='
html+='
';for(varj=0; jhtml+='
';}else{
html+='
';}
}
html+='
';}
html+='
';varr=document.createElement("div");r.innerHTML=html;varlist=r.getElementsByTagName("td");for(vari=0; i
list[i].style.width=size+"px";
list[i].style.height=size+"px";
list[i].style.border="solid 1px #fff";
}returnr.innerHTML;
}var__list=[
[
[1,1,1],
[1,0,1],
[1,0,1],
[1,0,1],
[1,1,1]
],
[
[0,1,0],
[1,1,0],
[0,1,0],
[0,1,0],
[1,1,1]
],
[
[1,1,1],
[0,0,1],
[1,1,1],
[1,0,0],
[1,1,1]
],
[
[1,1,1],
[0,0,1],
[1,1,1],
[0,0,1],
[1,1,1]
],
[
[1,0,1],
[1,0,1],
[1,1,1],
[0,0,1],
[0,0,1]
],
[
[1,1,1],
[1,0,0],
[1,1,1],
[0,0,1],
[1,1,1]
],
[
[1,1,1],
[1,0,0],
[1,1,1],
[1,0,1],
[1,1,1]
],
[
[1,1,1],
[0,0,1],
[0,0,1],
[0,0,1],
[0,0,1]
],
[
[1,1,1],
[1,0,1],
[1,1,1],
[1,0,1],
[1,1,1]
],
[
[1,1,1],
[1,0,1],
[1,1,1],
[0,0,1],
[1,1,1]
]
]