</html>
</body>
<p class="tip2">* 初級(jí):內(nèi)中再有躲藏參數(shù)delay(mouseover形式中的提早,默許100毫秒提早)、index(開(kāi)端時(shí)顯現(xiàn)tab序號(hào),默許是0,即顯現(xiàn)第一度tab),可自行按需增添</p>
</div>
</pre>
});
height:61//高(形式區(qū))
width:424,//寬(形式區(qū))
time:2,//主動(dòng)切換形式時(shí)的切換工夫距離
auto:false,//能否主動(dòng)切換,true為主動(dòng),false為非主動(dòng)
trigger:'click',//tab切換形式:'click'(點(diǎn)擊切換)/'mouseover'(懸停切換)
id:'myFocus',//綁定ID
style:'mF_tab',//格調(diào)款式
myFocus.setting({
<pre>
<p>myFocus-tab的調(diào)用和參數(shù)安裝:</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;請(qǐng)少待...&lt;/span&gt;&lt;/div&gt;&lt;!--載入畫(huà)面--&gt;
&lt;div id="myFocus"&gt;
<pre>
<p>myFocus-tab的HTML構(gòu)造</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>請(qǐng)少待...</span></div><!--載入畫(huà)面-->
<div id="myFocus">
<body>
</head>
</script>
});
height:61//高(形式區(qū))
width:424,//寬(形式區(qū))
time:2,//主動(dòng)切換形式時(shí)的切換工夫距離
auto:false,//能否主動(dòng)切換,true為主動(dòng),false為非主動(dòng)
trigger:'click',//tab切換形式:'click'(點(diǎn)擊切換)/'mouseover'(懸停切換)
id:'myFocus',//綁定ID
style:'mF_tab',//格調(diào)款式
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;//運(yùn)轉(zhuǎn)時(shí)有關(guān)參數(shù)
var btn=this.$li(box,0),swt=this.$$('ul',box)[2];//界說(shuō)焦點(diǎn)圖元素
this.$$('ul',box)[1].innerHTML='<li><ul class=swt>'+this.$$('ul',box)[1].innerHTML+'</ul></li>';
var box=this.$(par.id);//界說(shuō)焦點(diǎn)圖匣子
mF_tab:function(par){
myFocus.extend({
*/
* myFocus焦點(diǎn)圖庫(kù)及肌肉可自正在運(yùn)用,保存筆者有關(guān)消息即可,謝謝支撐!^^
* 上面是各款基于myFocus庫(kù)制造的焦點(diǎn)圖格調(diào)肌肉,可自行按需取舍
* myFocus焦點(diǎn)圖根本庫(kù)代碼終了
/*
};
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 沒(méi)有支撐那樣的事情 \"'+"+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,內(nèi)中封裝有:cla='txt'(生成alt文字),cla='num'(生成旋鈕數(shù)目字),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){//中止一切活動(dòng)因變量
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){//獲得或者安裝對(duì)于象通明度,默許100
style:function(obj,style){return (+[1,])?window.getComputedStyle(obj,null)[style]:obj.currentStyle[style];},//getStyle簡(jiǎn)化版
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焦點(diǎn)圖根本庫(kù)代碼開(kāi)端
/*
<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標(biāo)簽式欄目很盛行,簡(jiǎn)直一切網(wǎng)站都用到,而完成的代碼也無(wú)比容易,一度重復(fù)即可,但缺欠(絕對(duì)于圓滿(mǎn))也很顯然,率先是html形式很糟糕,加了很多js掌握蹤跡,相似某個(gè)標(biāo)簽加個(gè)onmouseover=xxxx(參數(shù)1,參數(shù)2),那個(gè)標(biāo)簽加個(gè)class="show",或者“hidden”,橫豎就是沒(méi)有能夠隨便的增多/芟除一度tab的html構(gòu)造,再次是性能很無(wú)限,調(diào)用也比擬費(fèi)事等....綜上,試驗(yàn)用myFocus庫(kù)完成了一度能夠是2100年眼前最圓滿(mǎn)的tab讀物^^
}
winname.close();
winname.document.execCommand('saveas','','性能壯大的主頁(yè)版極品年歷.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上無(wú)效\n\n請(qǐng)正在文本域頂用Ctrl+A取舍再?gòu)?fù)制")
}else{
alert("代碼曾經(jīng)復(fù)制到剪切板");
textRange.execCommand("Copy");
textRange = getByid("runcode"+obj).createTextRange();
if (document.all){
function doCopy(obj) {
//復(fù)制代碼
}
newwin.document.close();
newwin.document.write(code); //向某個(gè)翻開(kāi)的窗口中寫(xiě)入代碼code,那樣就完成了運(yùn)轉(zhuǎn)代碼性能。
function runCode(obj){ //界說(shuō)一度運(yùn)轉(zhuǎn)代碼的因變量,
}
}
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){
//運(yùn)轉(zhuǎn)框操作
}
}
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) {
//獲取一度對(duì)于象
。
var code=getByid("runcode"+obj).value;//即要運(yùn)轉(zhuǎn)的代碼。
newwin.opener = null // 預(yù)防代碼對(duì)于論談頁(yè)面修正
var newwin=window.open('','',''); //翻開(kāi)一度窗口并賦給變量newwin。