</html>
</body>
<p class="tip2">* 初级:内中再有躲藏参数delay(mouseover形式中的提早,默许100毫秒提早)、index(开端时显现tab序号,默许是0,即显现第一度tab),可自行按需增添</p>
</div>
</pre>
});
height:61//高(形式区)
width:424,//宽(形式区)
time:2,//主动切换形式时的切换工夫距离
auto:false,//能否主动切换,true为主动,false为非主动
trigger:'click',//tab切换形式:'click'(点击切换)/'mouseover'(悬停切换)
id:'myFocus',//绑定ID
style:'mF_tab',//格调款式
myFocus.setting({
<pre>
<p>myFocus-tab的调用和参数安装:</p>
<div class="tip">
</div>
</pre>
&lt;/div&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;p&gt;姘头姘头姘头&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;眷属眷属眷属&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;小弟小弟小弟&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;冤家冤家冤家&lt;/p&gt;&lt;/li&gt;
&lt;ul class="cont"&gt;&lt;!--形式--&gt;
&lt;/ul&gt;
&lt;li&gt;姘头&lt;/li&gt;
&lt;li&gt;眷属&lt;/li&gt;
&lt;li&gt;小弟&lt;/li&gt;
&lt;li&gt;冤家&lt;/li&gt;
&lt;ul class="btn"&gt;&lt;!--题目--&gt;
&lt;div class="loading"&gt;&lt;span&gt;请少待...&lt;/span&gt;&lt;/div&gt;&lt;!--载入画面--&gt;
&lt;div id="myFocus"&gt;
<pre>
<p>myFocus-tab的HTML构造</p>
<div class="tip">
</div>
</ul>
<li><p>姘头姘头姘头</p></li>
<li><p>眷属眷属眷属</p></li>
<li><p>小弟小弟小弟</p></li>
<li><p>冤家冤家冤家</p></li>
<ul class="cont"><!--形式-->
</ul>
<li>姘头</li>
<li>眷属</li>
<li>小弟</li>
<li>冤家</li>
<ul class="btn"><!--题目-->
<div class="loading"><span>请少待...</span></div><!--载入画面-->
<div id="myFocus">
<body>
</head>
</script>
});
height:61//高(形式区)
width:424,//宽(形式区)
time:2,//主动切换形式时的切换工夫距离
auto:false,//能否主动切换,true为主动,false为非主动
trigger:'click',//tab切换形式:'click'(点击切换)/'mouseover'(悬停切换)
id:'myFocus',//绑定ID
style:'mF_tab',//格调款式
myFocus.setting({
})
}
eval(this.bind('btn','par.trigger',par.delay));
}))
btn[next].className='current';
myFocus.slide(swt,{left:-(next*par.width)},20,'easeInOut')
},function(){
btn[index].className='';
eval(this.switchMF(function(){
//PLAY
box.style.cssText='width:'+(par.width+2)+'px;height:'+(par.height+29)+'px;'
swt.style.width=n*par.width+'px';
this.$$('ul',box)[1].style.cssText='width:'+par.width+'px;height:'+par.height+'px;';
//CSS
var index=par.index0,n=btn.length,t=par.time*1000;//运转时有关参数
var btn=this.$li(box,0),swt=this.$$('ul',box)[2];//界说焦点图元素
this.$$('ul',box)[1].innerHTML='<li><ul class=swt>'+this.$$('ul',box)[1].innerHTML+'</ul></li>';
var box=this.$(par.id);//界说焦点图匣子
mF_tab:function(par){
myFocus.extend({
*/
* myFocus焦点图库及肌肉可自正在运用,保存笔者有关消息即可,谢谢支撑!^^
* 上面是各款基于myFocus库制造的焦点图格调肌肉,可自行按需取舍
* myFocus焦点图根本库代码终了
/*
};
extend:function(fnObj){for(var p in fnObj) this[p]=fnObj[p];}
},
return "for (var j=0;j<n;j++){"+arrStr+"[j].index=j;if("+type+"=='click'){"+arrStr+"[j].onmouseover=function(){if(this.className!='current') this.className='hover'};"+arrStr+"[j].onmouseout=function(){if(this.className=='hover') this.className=''};"+arrStr+"[j].onclick=function(){if(this.index!=index) run(this.index)};}else if("+type+"=='mouseover'){"+arrStr+"[j].onmouseover=function(){var self=this;if("+delay+"==0){if(!self.className) run(self.index)}else "+arrStr+".d=setTimeout(function(){if(!self.className) run(self.index)},"+(delay==undefined?100:delay)+")};"+arrStr+"[j].onmouseout=function(){clearTimeout("+arrStr+".d)};}else{alert('myFocus 没有支撑那样的事情 \"'+"+type+"+'\"');break;}}"
bind:function(arrStr,type,delay){
},
return "box.removeChild(this.$$('div',box)[0]);var run=function(idx){("+fn1+")();if (index == n - 1) index = -1;var next = idx != undefined ? idx: index + 1;("+fn2+")();index=next;};run(index);if(par.auto!==false) var auto=setInterval(function(){run()},t);box.onmouseover=function(){if(auto) clearInterval(auto);};box.onmouseout=function(){if(auto) auto=setInterval(function(){run()},t);}"
switchMF:function(fn1,fn2){
},
}; obj.innerHTML+=s.join('');
s.push('</ul>');
for(var i=0;i<n;i++){s.push('<li>'+(cla[j]=='num'?('<a>'+(i+1)+'</a>'):(cla[j]=='txt'?this.$li(obj,0)[i].innerHTML.replace(/\>(.\n\r)*?(\<\/a\>)/i,'>'+(this.$$('img',obj)[i]?this.$$('img',obj)[i].alt:'')+'</a>'):(cla[j]=='thumb'?'<img src='+(this.$$('img',obj)[i].getAttribute("thumb")this.$$('img',obj)[i].src)+' />':'')))+'<span></span></li>')};
s.push('<ul class='+cla[j]+'>');
for(var j=0;j<num;j++){
var s=[],n=this.$li(obj,0).length,num=cla.length;
addList:function(obj,cla){//生成HMTL,cla为生成列表的class,内中封装有:cla='txt'(生成alt文字),cla='num'(生成旋钮数目字),cla='thumb'(生成小图)
},
else{document.addEventListener("DOMContentLoaded",function(){myFocus.$(par.id).className=par.style;myFocus.initCSS(par);},false);window.addEventListener('load',function(){myFocus[par.style](par)},false);}
if(window.attachEvent){(function(){try{myFocus.$(par.id).className=par.style;myFocus.initCSS(par);}catch(e){setTimeout(arguments.callee,0);}})();window.attachEvent('onload',function(){myFocus[par.style](par)});}
setting:function(par){
},
var oHead = this.$$('head',document)[0];oHead.insertBefore(oStyle,oHead.firstChild);
if(oStyle.styleSheet){oStyle.styleSheet.cssText=css.join('');} else {oStyle.innerHTML=css.join('');}
if(p.width){css.push('.'+p.style+' *{margin:0;padding:0;border:0;list-style:none;}.'+p.style+'{position:relative;width:'+p.width+'px;height:'+p.height+'px;overflow:hidden;font:12px/1.5 Verdana,Geneva,sans-serif;background:#fff;}.'+p.style+' .loading{position:absolute;z-index:9999;width:100%;height:100%;color:#666;text-align:center;padding-top:'+0.3*p.height+'px;background:#fff}.'+p.style+' .swt,.'+p.style+' .swt li{width:'+p.width+'px;height:'+p.height+'px;overflow:hidden;}.'+p.style+' .txt li,.'+p.style+' .txt li span,.'+p.style+' .txt-bg{width:'+p.width+'px;height:'+p.txtHeight+'px;line-height:'+p.txtHeight+'px;overflow:hidden;}')}
var css=[],oStyle = document.createElement('style');oStyle.type='text/css';
initCSS:function(p){
},
return this;
for(var i=0;i<animate.length;i++) if(obj[animate[i]+'Timer']) clearInterval(obj[animate[i]+'Timer']);
var animate=['left','right','top','bottom','width','height','opacity'];
stop:function(obj){//中止一切活动因变量
slide:function(obj,params,speed,easing,fn){for(var p in params) this.animate(obj,p,params[p],speed,easing,fn);return this;},
fadeOut:function(obj,speed,fn){this.animate(obj,'opacity',0,speed==undefined?20:speed,'linear',fn);return this;},
fadeIn:function(obj,speed,fn){this.animate(obj,'opacity',100,speed==undefined?20:speed,'linear',fn);return this;},
},
},10);return this;
else {if(opa&&val==0){obj.style.display='none'}clearInterval(obj[prop+'Timer']);fn&&fn.call(obj);}
else if(!opa&&t<d){obj.style[prop]=Math[m](myFocus[st](++t,b,c,d))+'px';}
if(opa&&t<d){myFocus.opa(obj,Math[m](myFocus[st](++t,b,c,d)));}
obj[prop+'Timer']=setInterval(function(){
if(obj[prop+'Timer']) clearInterval(obj[prop+'Timer']);
var t=0,b=opa?this.opa(obj):parseInt(this.style(obj,prop)),c=val-b,d=spd50,st=type'easeOut',m=c>0?'ceil':'floor';
if(opa&&obj.style.display=='none'){obj.style.display='';this.opa(obj,0);}
var opa=prop=='opacity'?true:false;
animate:function(obj,prop,val,spd,type,fn){
},
else return (!+[1,])?((obj.filters.alpha)?obj.filters.alpha.opacity:100):((obj.style.opacity)?obj.style.opacity*100:100);
if(v!=undefined) {v=v>100?100:(v<0?0:v); obj.style.filter = "alpha(opacity=" + v + ")"; obj.style.opacity = (v / 100);}
opa:function(obj,v){//获得或者安装对于象通明度,默许100
style:function(obj,style){return (+[1,])?window.getComputedStyle(obj,null)[style]:obj.currentStyle[style];},//getStyle简化版
easeInOut:function(t,b,c,d){return ((t/=d/2) < 1)?(c/2*t*t*t*t + b):(-c/2*((t-=2)*t*t*t - 2) + b);},
easeOut:function(t,b,c,d){return -c*((t=t/d-1)*t*t*t - 1) + b;},
easeIn:function(t,b,c,d){return c*(t/=d)*t*t*t + b;},
linear:function(t,b,c,d){return c*t/d + b;},
$li:function(obj,n){return this.$$('li',this.$$('ul',obj)[n])},
$$:function(tag,obj){return (typeof obj=='object'?obj:this.$(obj)).getElementsByTagName(tag);},
$:function(id){return document.getElementById(id);},
var myFocus={
*/
* myFocus焦点图根本库代码开端
/*
<script type="text/javascript">
</style>
.mF_tab .cont .swt li p{padding:16px;}
.mF_tab .cont .swt li{float:left;}
.mF_tab .cont .swt{position:absolute;left:0;top:0;}
.mF_tab .cont{position:absolute;top:27px;left:0;border:1px solid #dedede;overflow:hidden;}
.mF_tab .btn li.current{height:27px;background:#fff;}
.mF_tab .btn li{float:left;width:80px;height:26px;line-height:26px;text-align:center;margin-right:2px;border:1px solid #dedede;border-bottom:0;cursor:pointer;background:#f1f1f1;}
.mF_tab .btn{position:absolute;top:0;left:0;z-index:2;}
.mF_tab{width:426px;height:90px;}
/*=========mF_tab--========*/
.tip2{font-size:12px;color:#888;margin-top:16px;}
.tip pre{background:##AFF8AB;}
.tip p{height:30px;line-height:30px;padding-left:16px;background:#f1f1f1;}
.tip{border:1px solid #dedede;margin-top:20px;font-family:Verdana, Geneva, sans-serif;}
body{background:#fff;padding:20px;}
*{margin:0;padding:0;border:0;list-style:none;}
<style type="text/css">
<title>myFocus v1.0.0 beta</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
tab标签式栏目很盛行,简直一切网站都用到,而完成的代码也无比容易,一度重复即可,但缺欠(绝对于圆满)也很显然,率先是html形式很糟糕,加了很多js掌握踪迹,相似某个标签加个onmouseover=xxxx(参数1,参数2),那个标签加个class="show",或者“hidden”,横竖就是没有能够随便的增多/芟除一度tab的html构造,再次是性能很无限,调用也比拟费事等....综上,试验用myFocus库完成了一度能够是2100年眼前最圆满的tab读物^^
}
winname.close();
winname.document.execCommand('saveas','','性能壮大的主页版极品年历.html');
winname.document.write(obj.value);
winname.document.open('text/html', 'replace');
var winname = window.open('','','width=0,height=0,top=200,left=200px');
function saveCode(obj) {
//另存代码
}
}
alert("此性能只能正在IE上无效\n\n请正在文本域顶用Ctrl+A取舍再复制")
}else{
alert("代码曾经复制到剪切板");
textRange.execCommand("Copy");
textRange = getByid("runcode"+obj).createTextRange();
if (document.all){
function doCopy(obj) {
//复制代码
}
newwin.document.close();
newwin.document.write(code); //向某个翻开的窗口中写入代码code,那样就完成了运转代码性能。
function runCode(obj){ //界说一度运转代码的因变量,
}
}
labs[i].id=i
buts[i].id=i
inps[i].id=i
objs[i].id="runcode"+i;
for (i=0; i<objs.length; i++) {
var labs=getByid(DivID).getElementsByTagName('label');
var buts=getByid(DivID).getElementsByTagName('button');
var inps=getByid(DivID).getElementsByTagName('input');
var objs=getByid(DivID).getElementsByTagName('textarea');
function creatID(DivID){
//运转框操作
}
}
return null;
} else {
return document.layers[id];
} else if (document.layers) {
return document.all[id];
} else if (document.all) {
return document.getElementById(id);
if (document.getElementById) {
function getByid(id) {
//获取一度对于象
。
var code=getByid("runcode"+obj).value;//即要运转的代码。
newwin.opener = null // 预防代码对于论谈页面修正
var newwin=window.open('','',''); //翻开一度窗口并赋给变量newwin。