只加载出来一个函数的功能……
<script type="text/javascript">
function addLoadEvent(func){
var oldonload= window.onload;
if(typeof window.onload!='function'){
window.onload=func;
}
else{
window.onload=function(){
oldonload();
func();
}
}
}
function createTag(){//动态创建b标签
var li= document.getElementById("checkList").getElementsByTagName("li");
var label;
for( var i=0;i<=li.length;i++){
label=li[i].getElementsByTagName("label");
var btg=document.createElement("b");
li[i].insertBefore(btg,label[0]);
}
}
function checklist(){
var li= document.getElementById("checkList").getElementsByTagName("li");
for( var i=0;i<=li.length;i++){
li[i].onclick=function(){
if(this.className=="selected"){
this.className=null;
}
else {
this.className="selected";
}
}
}
}
addLoadEvent(createTag);
addLoadEvent(checklist);
</script>