JS做选项卡的类,哪个帮忙加个注释嘛。
前台BODY里面的代码,样式不用去管它
<body>
<div class="tabParentCss">
<div class="tabParentCssLeft">
</div>
<div class="tabParentCssMiddel" id="tabApplication">
<div class="newSelectedTabCss_1" istab="2" style="margin-top: 7px; padding-left: 7px;
padding-right: 7px; padding-top: 3px;" title="高考GPS">
选项1</div>
<div class="newSelectedTabCss" istab="1" style="margin-top: 7px; padding-left: 7px;
padding-right: 7px; padding-top: 3px;" title="高考GPS">
选项2</div>
<div class="newSelectedTabCss" istab="1" style="margin-top: 7px; padding-left: 7px;
padding-right: 7px; padding-top: 3px;" title="高考GPS">
选项3</div>
<div class="newSelectedTabCss" istab="1" style="margin-top: 7px; padding-left: 7px;
padding-right: 7px; padding-top: 3px;" title="高考GPS">
选项4</div>
</div>
<div class="tabParentCssRight">
</div>
<div class="bodyParentCss" style="padding-left:20px;">
数据加载中......
</div>
</div>
<script language="javascript" type="text/javascript">
(function () {
new applicationObject(document.getElementById("tabApplication"));
})();
</script>
</body>
JS里面的代码,好心人加个注释噻,表示看不明白
?function createDelegate(obj,exObj){
return function(){
exObj.apply(obj,arguments);
}
}
function addEventHander(obj,eventName,execMethed){
if(window.addEventListener){
obj.addEventListener(eventName,execMethed,false);
}else if(window.attachEvent){
obj.attachEvent("on"+eventName,execMethed);
}else{
obj["on"+eventName]=eventName;
}
}
function removeEventHander(obj,eventName,execMethed){
if(window.removeEventListener){
obj.removeEventListener(eventName,execMethed,false);
}else if(window.attachEvent){
obj.detachEvent("on"+eventName,execMethed);
}else{
obj["on"+eventName]=null;
}
}
function objParent(e){
if(window.event){
return e.srcElement;
}else{
return e.target;
}
}
function tabClickEvent(e){
var divObject=objParent(e);
for(var i=0;i<applicationClass.tabArray.length;i++){
removeEventHander(applicationClass.tabArray[i],"click",tabClickEvent);
if(applicationClass.tabArray[i]==divObject){
addEventHander(applicationClass.tabArray[i],"click",e);
applicationClass.tabArray[i].className="newSelectedTabCss_1";
}else{
addEventHander(applicationClass.tabArray[i],"click",tabClickEvent);
applicationClass.tabArray[i].className="newSelectedTabCss";
}
}
alert(divObject.innerHTML)
}
var applicationClass=null;
function applicationObject(){this.load.apply(this,arguments);}
applicationObject.prototype={
load:function(tabObject){
applicationClass=this;
this.tabObject=tabObject;
var getTabArray=this.tabObject.getEleme