问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

请问这段JS代码什么意思??说是舌签构造函数

发布网友 发布时间:2022-05-05 15:23

我来回答

3个回答

热心网友 时间:2022-06-27 16:34

解压并对部分函数做了解释

/* ========== 舌签构造函数 begin ========== */

var isIE = navigator.appVersion.indexOf("MSIE") != -1 ? true: false;
function SubShowClass(h, j, k, l, m) {//主函数 h-舌簧的id名程;j-设置响应类型:有五种状态响应onmouseover、onmouseout、click、mouseup、mousedown;k、l、m-默认选中容器(div)的索引序号、默认选中、关闭容器id名称;注意k、l、m都是相对于舌簧tab(h)的子容器
this.version = "1.0";
this.author = "mengjia";
this.parentObj = SubShowClass.$(h);//取得舌簧id
if (this.parentObj == null) {
throw new Error("SubShowClass(ID)参数错误:ID 对像存在!")
};
if (!SubShowClass.childs) {
SubShowClass.childs = new Array()//以下将需开关显示的容器名(div)取得并压入js数组
};
this.ID = SubShowClass.childs.length;
SubShowClass.childs.push(this);
this.lock = false;//以下设置状态参数值
this.label = [];
this.defaultID = k == null ? 0: k;
this.selectedIndex = this.defaultID;
this.openClassName = l == null ? "selected": l;
this.closeClassName = m == null ? "": m;
this.mouseIn = false;
var n = Function("SubShowClass.childs[" + this.ID + "].mouseIn = true");
var o = Function("SubShowClass.childs[" + this.ID + "].mouseIn = false");
if (isIE) {
this.parentObj.attachEvent("onmouseover", n)
} else {
this.parentObj.addEventListener("mouseover", n, false)
};
if (isIE) {
this.parentObj.attachEvent("onmouseout", o)
} else {
this.parentObj.addEventListener("mouseout", o, false)
};
if (typeof(j) != "string") {//以下设置舌簧鼠标响应类型
j = "onmousedown"
};
j = j.toLowerCase();
switch (j) {
case "onmouseover":
this.eventType = "mouseover";
break;
case "onmouseout":
this.eventType = "mouseout";
break;
case "onclick":
this.eventType = "click";
break;
case "onmouseup":
this.eventType = "mouseup";
break;
default:
this.eventType = "mousedown"
};
this.addLabel = function(a, b, c, d, e) {//该函数根据取得的状态显示或关闭子容器并设置tab背景样式(c参数)
if (SubShowClass.$(a) == null) {
throw new Error("addLabel(labelID)参数错误:labelID 对像存在!")
};
var f = this.label.length;
if (c == "") {
c = null
};
this.label.push([a, b, c, d, e]);
var g = Function('SubShowClass.childs[' + this.ID + '].select(' + f + ')');
if (isIE) {
SubShowClass.$(a).attachEvent("on" + this.eventType, g)
} else {
SubShowClass.$(a).addEventListener(this.eventType, g, false)
};
if (f == this.defaultID) {
SubShowClass.$(a).className = this.openClassName;
if (SubShowClass.$(b)) {
SubShowClass.$(b).style.display = ""
};
if (c != null) {
this.parentObj.style.background = c
};
if (d != null) {
eval(d)
}
} else {
SubShowClass.$(a).className = this.closeClassName;
if (SubShowClass.$(b)) {
SubShowClass.$(b).style.display = "none"
}
};
if (SubShowClass.$(b)) {
if (isIE) {
SubShowClass.$(b).attachEvent("onmouseover", n)
} else {
SubShowClass.$(b).addEventListener("mouseover", n, false)
};
if (isIE) {
SubShowClass.$(b).attachEvent("onmouseout", o)
} else {
SubShowClass.$(b).addEventListener("mouseout", o, false)
}
}
};
this.select = function(a) {//调用函数具体设置选中tab状态或样式
if (typeof(a) != "number") {
throw new Error("select(num)参数错误:num 不是 number 类型!")
};
var i;
for (i = 0; i < this.label.length; i++) {
if (i == a) {
SubShowClass.$(this.label[i][0]).className = this.openClassName;
if (SubShowClass.$(this.label[i][1])) {
SubShowClass.$(this.label[i][1]).style.display = ""
};
if (this.label[i][2] != null) {
this.parentObj.style.background = this.label[i][2]
};
if (this.label[i][3] != null) {
eval(this.label[i][3])
}
} else if (this.selectedIndex == i) {
SubShowClass.$(this.label[i][0]).className = this.closeClassName;
if (SubShowClass.$(this.label[i][1])) {
SubShowClass.$(this.label[i][1]).style.display = "none"
};
if (this.label[i][4] != null) {
eval(this.label[i][4])
}
}
};
this.selectedIndex = a
};
this.random = function() {
if (arguments.length != this.label.length) {
throw new Error("random()参数错误:参数数量与标签数量不符!")
};
var a = 0,
i;
for (i = 0; i < arguments.length; i++) {
a += arguments[i]
};
var b = Math.random(),
percent = 0;
for (i = 0; i < arguments.length; i++) {
percent += arguments[i] / a;
if (b < percent) {
this.select(i);
break
}
}
};
this.autoPlay = false;
var p = null;
this.spaceTime = 5000;
this.play = function(a) {
if (typeof(a) == "number") {
this.spaceTime = a
};
clearInterval(p);
p = setInterval("SubShowClass.childs[" + this.ID + "].nextLabel()", this.spaceTime);
this.autoPlay = true
};
this.nextLabel = function() {
if (this.autoPlay == false || this.mouseIn == true) {
return
};
var a = this.selectedIndex;
a++;
if (a >= this.label.length) {
a = 0
};
this.select(a)
};
this.stop = function() {
clearInterval(p);
this.autoPlay = false
}
};
SubShowClass.$ = function(a) {//取得tab h的超链接
if (document.getElementById) {
return eval('document.getElementById("' + a + '")')
} else {
return eval('document.all.' + a)
}
}
/* ========== 舌签构造函数 end ========== */

热心网友 时间:2022-06-27 16:34

function SubShowClass(h,j,k,l,m){
this.version="1.21";
this.author="mengjia";
this.parentObj=SubShowClass.$(h);
if(this.parentObj==null&&h!="none"){
throw new Error("SubShowClass(ID)\u53c2\u6570\u9519\u8bef:ID \u5bf9\u50cf\u5b58\u5728!(value:"+h+")");
}
if(!SubShowClass.childs){
SubShowClass.childs=[];
}
this.ID=SubShowClass.childs.length;
SubShowClass.childs.push(this);
this.lock=false;
this.label=[];
this.defaultID=k==null?0:k;
this.selectedIndex=this.defaultID;
this.openClassName=l==null?"selected":l;
this.closeClassName=m==null?"":m;
this.mouseIn=false;
var n=Function("SubShowClass.childs["+this.ID+"].mouseIn = true"),mouseOutFunc=Function("SubShowClass.childs["+this.ID+"].mouseIn = false");
if(h!="none"){
if(this.parentObj.attachEvent){
this.parentObj.attachEvent("onmouseover",n);
}else {
this.parentObj.addEventListener("mouseover",n,false);
}
}
if(h!="none"){
if(this.parentObj.attachEvent){
this.parentObj.attachEvent("onmouseout",mouseOutFunc);
}else {
this.parentObj.addEventListener("mouseout",mouseOutFunc,false);
}
}
if(typeof (j)!="string"){
j="onmousedown";
}
j=j.toLowerCase();
switch(j){
case "onmouseover":
this.eventType="mouseover";
break ;
case "onmouseout":
this.eventType="mouseout";
break ;
case "onclick":
this.eventType="click";
break ;
case "onmouseup":
this.eventType="mouseup";
break ;
default:
this.eventType="mousedown";
}
this.addLabel=function(a,b,c,d,e){
if(SubShowClass.$(a)==null&&a!="none"){
throw new Error("addLabel(labelID)\u53c2\u6570\u9519\u8bef:labelID \u5bf9\u50cf\u5b58\u5728!(value:"+a+")");
}
var f=this.label.length;
if(c==""){
c=null;
}
this.label.push([a,b,c,d,e]);
var g=Function("SubShowClass.childs["+this.ID+"].select("+f+")");
if(a!="none"){
if(SubShowClass.$(a).attachEvent){
SubShowClass.$(a).attachEvent("on"+this.eventType,g);
}else {
SubShowClass.$(a).addEventListener(this.eventType,g,false);
}
}
if(f==this.defaultID){
if(a!="none"){
SubShowClass.$(a).className=this.openClassName;
}
if(SubShowClass.$(b)){
SubShowClass.$(b).style.display="";
}
if(h!="none"){
if(c!=null){
this.parentObj.style.background=c;
}
}
if(d!=null){
eval(d);
}
}else {
if(a!="none"){
SubShowClass.$(a).className=this.closeClassName;
}
if(SubShowClass.$(b)){
SubShowClass.$(b).style.display="none";
}
}
if(SubShowClass.$(b)){
if(SubShowClass.$(b).attachEvent){
SubShowClass.$(b).attachEvent("onmouseover",n);
}else {
SubShowClass.$(b).addEventListener("mouseover",n,false);
}
if(SubShowClass.$(b).attachEvent){
SubShowClass.$(b).attachEvent("onmouseout",mouseOutFunc);
}else {
SubShowClass.$(b).addEventListener("mouseout",mouseOutFunc,false);
}
}
};
this.select=function(a,b){
if(typeof (a)!="number"){
throw new Error("select(num)\u53c2\u6570\u9519\u8bef:num \u4e0d\u662f number \u7c7b\u578b!(value:"+a+")");
}
if(b!=true&&this.selectedIndex==a){
return ;
}
var i;
for(i=0;i<this.label.length;i++){
if(i==a){
if(this.label[i][0]!="none"){
SubShowClass.$(this.label[i][0]).className=this.openClassName;
}
if(SubShowClass.$(this.label[i][1])){
SubShowClass.$(this.label[i][1]).style.display="";
}
if(h!="none"){
if(this.label[i][2]!=null){
this.parentObj.style.background=this.label[i][2];
}
}
if(this.label[i][3]!=null){
eval(this.label[i][3]);
}
}else {
if(this.selectedIndex==i||b==true){
if(this.label[i][0]!="none"){
SubShowClass.$(this.label[i][0]).className=this.closeClassName;
}
if(SubShowClass.$(this.label[i][1])){
SubShowClass.$(this.label[i][1]).style.display="none";
}
if(this.label[i][4]!=null){
eval(this.label[i][4]);
}
}
}
}
this.selectedIndex=a;
};
this.random=function(){
if(arguments.length!=this.label.length){
throw new Error("random()\u53c2\u6570\u9519\u8bef:\u53c2\u6570\u6570\u91cf\u4e0e\u6807\u7b7e\u6570\u91cf\u4e0d\u7b26!(length:"+arguments.length+")");
}
var a=0,i;
for(i=0;i<arguments.length;i++){
a+=arguments[i];
}
var b=Math.random(),percent=0;
for(i=0;i<arguments.length;i++){
percent+=arguments[i]/a;
if(b<percent){
this.select(i);
break ;
}
}
};
this.autoPlay=false;
var o=null;
this.spaceTime=5000;
this.play=function(a){
if(typeof (a)=="number"){
this.spaceTime=a;
}
clearInterval(o);
o=setInterval("SubShowClass.childs["+this.ID+"].autoPlayFunc()",this.spaceTime);
this.autoPlay=true;
};
this.autoPlayFunc=function(){
if(this.autoPlay==false||this.mouseIn==true){
return ;
}
this.nextLabel();
};
this.nextLabel=function(){
var a=this.selectedIndex;
a++;
if(a>=this.label.length){
a=0;
}
this.select(a);
if(this.autoPlay==true){
clearInterval(o);
o=setInterval("SubShowClass.childs["+this.ID+"].autoPlayFunc()",this.spaceTime);
}
};
this.previousLabel=function(){
var a=this.selectedIndex;
a--;
if(a<0){
a=this.label.length-1;
}
this.select(a);
if(this.autoPlay==true){
clearInterval(o);
o=setInterval("SubShowClass.childs["+this.ID+"].autoPlayFunc()",this.spaceTime);
}
};
this.stop=function(){
clearInterval(o);
this.autoPlay=false;
};
}
SubShowClass.$=function(a){
if(document.getElementById){
return eval("document.getElementById(\""+a+"\")");
}else {
return eval("document.all."+a);
}
};

热心网友 时间:2022-06-27 16:34

/* ========== 舌签构造函数 begin ========== */
var isIE = navigator.appVersion.indexOf("MSIE") != -1 ? true: false;
function SubShowClass(h, j, k, l, m) {
this.version = "1.0";
this.author = "mengjia";
this.parentObj = SubShowClass.$(h);
if (this.parentObj == null) {
throw new Error("SubShowClass(ID)参数错误:ID 对像存在!")
};
if (!SubShowClass.childs) {
SubShowClass.childs = new Array()
};
this.ID = SubShowClass.childs.length;
SubShowClass.childs.push(this);
this.lock = false;
this.label = [];
this.defaultID = k == null ? 0 : k;
this.selectedIndex = this.defaultID;
this.openClassName = l == null ? "selected": l;
this.closeClassName = m == null ? "": m;
this.mouseIn = false;
var n = Function("SubShowClass.childs[" + this.ID + "].mouseIn = true");
var o = Function("SubShowClass.childs[" + this.ID + "].mouseIn = false");
if (isIE) {
this.parentObj.attachEvent("onmouseover", n)
} else {
this.parentObj.addEventListener("mouseover", n, false)
};
if (isIE) {
this.parentObj.attachEvent("onmouseout", o)
} else {
this.parentObj.addEventListener("mouseout", o, false)
};
if (typeof(j) != "string") {
j = "onmousedown"
};
j = j.toLowerCase();
switch (j) {
case "onmouseover":
this.eventType = "mouseover";
break;
case "onmouseout":
this.eventType = "mouseout";
break;
case "onclick":
this.eventType = "click";
break;
case "onmouseup":
this.eventType = "mouseup";
break;
default:
this.eventType = "mousedown"
};
this.addLabel = function(a, b, c, d, e) {
if (SubShowClass.$(a) == null) {
throw new Error("addLabel(labelID)参数错误:labelID 对像存在!")
};
var f = this.label.length;
if (c == "") {
c = null
};
this.label.push([a, b, c, d, e]);
var g = Function('SubShowClass.childs[' + this.ID + '].select(' + f + ')');
if (isIE) {
SubShowClass.$(a).attachEvent("on" + this.eventType, g)
} else {
SubShowClass.$(a).addEventListener(this.eventType, g, false)
};
if (f == this.defaultID) {
SubShowClass.$(a).className = this.openClassName;
if (SubShowClass.$(b)) {
SubShowClass.$(b).style.display = ""
};
if (c != null) {
this.parentObj.style.background = c
};
if (d != null) {
eval(d)
}
} else {
SubShowClass.$(a).className = this.closeClassName;
if (SubShowClass.$(b)) {
SubShowClass.$(b).style.display = "none"
}
};
if (SubShowClass.$(b)) {
if (isIE) {
SubShowClass.$(b).attachEvent("onmouseover", n)
} else {
SubShowClass.$(b).addEventListener("mouseover", n, false)
};
if (isIE) {
SubShowClass.$(b).attachEvent("onmouseout", o)
} else {
SubShowClass.$(b).addEventListener("mouseout", o, false)
}
}
};
this.select = function(a) {
if (typeof(a) != "number") {
throw new Error("select(num)参数错误:num 不是 number 类型!")
};
var i;
for (i = 0; i < this.label.length; i++) {
if (i == a) {
SubShowClass.$(this.label[i][0]).className = this.openClassName;
if (SubShowClass.$(this.label[i][1])) {
SubShowClass.$(this.label[i][1]).style.display = ""
};
if (this.label[i][2] != null) {
this.parentObj.style.background = this.label[i][2]
};
if (this.label[i][3] != null) {
eval(this.label[i][3])
}
} else if (this.selectedIndex == i) {
SubShowClass.$(this.label[i][0]).className = this.closeClassName;
if (SubShowClass.$(this.label[i][1])) {
SubShowClass.$(this.label[i][1]).style.display = "none"
};
if (this.label[i][4] != null) {
eval(this.label[i][4])
}
}
};
this.selectedIndex = a
};
this.random = function() {
if (arguments.length != this.label.length) {
throw new Error("random()参数错误:参数数量与标签数量不符!")
};
var a = 0,
i;
for (i = 0; i < arguments.length; i++) {
a += arguments[i]
};
var b = Math.random(),
percent = 0;
for (i = 0; i < arguments.length; i++) {
percent += arguments[i] / a;
if (b < percent) {
this.select(i);
break
}
}
};
this.autoPlay = false;
var p = null;
this.spaceTime = 5000;
this.play = function(a) {
if (typeof(a) == "number") {
this.spaceTime = a
};
clearInterval(p);
p = setInterval("SubShowClass.childs[" + this.ID + "].nextLabel()", this.spaceTime);
this.autoPlay = true
};
this.nextLabel = function() {
if (this.autoPlay == false || this.mouseIn == true) {
return
};
var a = this.selectedIndex;
a++;
if (a >= this.label.length) {
a = 0
};
this.select(a)
};
this.stop = function() {
clearInterval(p);
this.autoPlay = false
}
};
SubShowClass.$ = function(a) {
if (document.getElementById) {
return eval('document.getElementById("' + a + '")')
} else {
return eval('document.all.' + a)
}
}
/* ========== 舌签构造函数 end ========== */
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
现代家庭健康饮食宝典目录 食疗炸菜商品描述 家常菜烹饪宝典内容简介 ...啊?是一幅他特别喜欢的图片,他曾经还求我画一张,当 ...4年老桩砍头了没留叶子,这杆子还能爆侧芽小仔吗?这杆子生长点在哪里... 家庭食疗宝典软件介绍 有个女生同学下周过生日告诉我让我送她生日礼物。我问他他要什么他说... 我有一个女同学生日,我XH她,她叫我送她一张贺卡,内容怎么写 魅族手机下载那种视频播放器可以小屏播放 一个蛮好的女同学要过生日,不知道送生日报怎么样。。有网友送过没,他们... matlab中关于pushbotton的左键双击响应问题 高分悬赏把这封推荐信翻译成英文!急求!! Shall I close the window? No, ( )it open. A make B try C push D leave pushed open the doors中open为什么不加ed,pushed为过去式,为什么后 苹果7push home to open 什么意思 记忆力及减退应吃什么? 记忆力减退吃什么 求一个数是另一个数的几倍就是求什么? 什么是因数、倍数举例说明 总数除以倍数等于什么 自己搭建的百科,用的是互动百科的源码.现在可以导入我自己其他网站的数据吗?是什么类型的数据库? 秦朝最终被谁推翻?建立了什么朝代? 公元207年 谁推翻了秦朝 建立了什么朝定都啥玩意儿? 怎样进行指纹支付? 情人节怎样跟女生约会呢? 指纹支付怎么修改 十二星座情人节最佳约会方式是什么? 求情人节约会的聊天技巧 。我是男的 刚认识的女生对她有感觉,如何过情人节? 情人节如何约会? Win10系统如何安装Linux Mint? push and hold disp 驾照报错车型了怎么办? 本来我报的C2但是约考却显示的C1 是不是驾校给我报错了 怎么办? 好心人帮我翻译 哪位英语高手,帮我翻译一篇英语文章吧!演讲要用拉! 初学驾照报名后发现驾校填错了怎么办? openfire 可以实现push吗 所学车型报错了能改吗科目一考试费已经交了还能改车型吗? 学驾照报错了所学车型怎么办理? 急急急!!!驾校报错了名字驾本已经拿到该怎么办? 汽车报错驾校可以更改吗? 考驾照车管所把c2错填成c1了怎么办? 干虾仁如何贮藏 我报错驾校了能再报其它驾校吗 微信里同学聚会照片视频能否集中在一起 word名单快速横排变竖排 ipadpro买的时候送键盘吗 买ipadPro键盘和笔是自己买,还是送的 12.9 ipad pro 有必要配一个鼠标键盘吗