关于奇矩互动奇矩互动招贤纳士奇矩互动优质虚拟主机Discuz!商业用户享有本站VIP服务LAMP环境配置手册(CentOS5.1)
 16 12
发新话题
打印

JavaScript 经典效果集

十五、功能强大的旋转导航文字圈
复制内容到剪贴板
代码:
<body>
<style type="text/css">
BODY
{
background : #efefef;
font : 12px Verdana;
}
A { color : #e70 }
A:hover { text-decoration : none }
.spin
{
position : absolute;
visibility : hidden;
z-index : auto;
}
.spin A
{
font : 12px Verdana;
text-decoration : none;
}
.spin A:hover
{
text-decoration : underline overline;
}
</style>
<script language="JavaScript1.2">
function getPageSize()
{
        this.x = document.getElementsByTagName('html').item(0).clientWidth||document.getElementsByTagName('html').item(0).offsetWidth||document.body.offsetWidth||innerWidth
        this.y = document.getElementsByTagName('html').item(0).clientHeight||document.getElementsByTagName('html').item(0).offsetHeight||document.body.offsetHeight||innerHeight
        this.x2 = parseInt(this.x/2)||0
        this.y2 = parseInt(this.y/2)||0
        this.sx = document.body.scrollWidth||0
        this.sy = document.body.scrollHeight||0
}
var pg
var pi = 3.1415
function spinMenu(cls,rad,eSpd,rSpd,dir,x,y,noCt,runEx)
{
        pg = new getPageSize()
        this.cls = cls
        this.rad = rad
        this.eSpd = eSpd
        this.rSpd = rSpd
        this.dir = dir ? 1 : -1
        this.x = x<0 ? pg.x2 : x
        this.y = y<0 ? pg.y2 : y
        this.runEx = runEx||0
        this.noCt = noCt||0
        this.r = 0 // radius flux
        this.ex = 0 // expand timeout
        this.ct = 0 // contract timeout
        this.rt = 1 // rotate timeout
        this.vis = 0 // visibility
        this.rNum = 0 // rotational flux
        this.rSpd2 = 0 // rSpd holder
        this.exDone = 0 // expand complete?
        this.ctDone = 1 // contract complete?
        this.toFig = 0
        this.atX = 0
        this.atY = 0
        this.url = 0
        this.target = 0
        eval(this.obj + "=this")
        this.items = new Array()
        this.el = document.getElementsByTagName('div')
        for(i=0;(this.el.item(i));i++)
        {
                if(this.el.item(i).className==this.cls)
                {
                        this.el.item(i).onmouseover = new Function(this.obj+'.stop()')
                        this.el.item(i).onmouseout = new Function(this.obj+'.rotate()')
                        this.el.item(i).onclick = new Function(this.obj+'.contract()')
                        this.items[this.items.length] = this.el.item(i)
                }
        }
        delete this.el
        for(i=0;(this.items[i]);i++)
        {
                if(!this.items[i].childNodes.item(0).nodeValue)
                {
                        this.items[i].childNodes.item(0).onmouseover = new Function('status=this.href;return true')
                        this.items[i].childNodes.item(0).onmouseout = new Function('status=\'\';return true')
                        this.items[i].childNodes.item(0).onclick = new Function(this.obj+'.setURL(this.href,this.target);return false')
                        this.items[i].childNodes.item(0).onfocus = new Function('this.blur()')
                }
        }
        return this
}
spinMenu.prototype.init = function()
{
        this.hide()
        this.place()
        this.expand()
}
spinMenu.prototype.rotate = function()
{
        if(this.rSpd)
        {
                this.rNum += pi/(1000/this.rSpd)*this.dir
                if(this.exDone)
                {
                        this.place()
                        clearTimeout(this.rt)
                        this.rt = setTimeout(this.obj+'.rotate()',20)
                }
        }
}
spinMenu.prototype.stop = function()
{
        clearTimeout(this.rt)
        this.rt = 0
}
spinMenu.prototype.expand = function()
{
        if(this.exDone!=1)
        {
                this.ctDone=0
                if(!this.vis) this.show()
                if(this.runEx) eval(this.runEx)
                if(this.ct!=0)
                {
                        clearTimeout(this.ct)
                        this.ct = 0
                }
                if(this.r<this.rad)
                {
                        this.r += this.eSpd
                        if(this.rSpd2==0) this.rSpd2 = this.rSpd
                        this.rSpd = this.eSpd*3
                        this.rotate()
                        this.place()
                        this.ex = setTimeout(this.obj+'.expand()',10)
                }
                else
                {
                        this.ex = 0
                        this.rSpd = this.rSpd2
                        this.rSpd2 = 0
                        this.ctDone = 0
                        this.exDone = 1
                        this.rotate()
                }
        }
}
spinMenu.prototype.contract = function()
{
        if(this.ctDone!=1&&!this.noCt)
        {
                this.exDone = 0
                if(this.ex!=0)
                {
                        clearTimeout(this.ex)
                        this.ex = 0
                }
                if(this.r>0)
                {
                        this.r -= this.eSpd
                        if(this.rSpd2==0) this.rSpd2 = this.rSpd
                        this.rSpd = this.eSpd
                        this.rotate()
                        this.place()
                        this.ct = setTimeout(this.obj+'.contract()',10)
                }
                else
                {
                        this.rSpd = this.rSpd2
                        this.rSpd2 = 0
                        this.rNum = 0
                        this.stop()
                        this.hide()
                        this.exDone = 0
                        this.ctDone = 1
                        this.goURL()
                }
        }
        else this.goURL()
}
spinMenu.prototype.place = function()
{
        for(i=0;(this.items[i]);i++)
        {
                this.atPt(i)
                this.items[i].style.left = this.atX-(this.items[i].offsetWidth/2)+'px'
                this.items[i].style.top = this.atY-(this.items[i].offsetHeight/2)+'px'
        }
}
spinMenu.prototype.atPt = function(pt)
{
        this.toFig = pi/(this.items.length/2)*(pt+this.rNum)
        this.atX = parseInt(Math.cos(this.toFig)*this.r+this.x)
        this.atY = parseInt(Math.sin(this.toFig)*this.r+this.y)
}
spinMenu.prototype.show = function()
{
        for(i=0;(this.items[i]);i++)
        {
                this.items[i].style.display = 'block'
                this.items[i].style.visibility = 'visible'
                this.vis = 1
        }
}
spinMenu.prototype.hide = function()
{
        for(i=0;(this.items[i]);i++)
        {
                this.items[i].style.visibility = 'hidden'
                this.items[i].style.display = 'none'
                this.vis = 0
        }
}
spinMenu.prototype.changeDir = function()
{
        this.dir = this.dir==1 ? -1 : 1
}
spinMenu.prototype.setURL = function(url,target)
{
        this.url = url
        this.target = target
}
spinMenu.prototype.goURL = function()
{
        if(this.url)
        {
                if(!this.target)
                        if(document.getElementsByTagName('base').length) this.target = document.getElementsByTagName('base').item(0).target
                if(this.target)
                {
                        if(this.target=='_blank') open(this.url)
                        else if(this.target=='_parent') parent.location = this.url
                        else if(this.target=='_top') top.location = this.url
                        else if(this.target.indexOf('_')<0)
                        {
                                if(eval('parent.'+this.target)) eval('parent.'+this.target+'.document.location=this.url')
                                else if(eval('top.'+this.target)) eval('top.'+this.target+'.document.location=this.url')
                                else open(this.url,this.target)
                        }
                        else location = this.url
                }
                else location = this.url
                this.url = 0
        }
}
</script>
<script language="JavaScript1.2" type="text/javascript">
function centerIt()
{
pg = new getPageSize()
menu.x = pg.x2-10
menu.y = pg.y2
}
function initSpinMenu()
{
menu = new spinMenu(
'spin', // className
120, // radius
12, // expand/contract speed
3, // rotational speed
1, // direction (cw=1,ccw=0)
-1, // origin x
-1, // origin y
0, // stay expanded?
0 // run before expand
)
menu.init()
}
onload=initSpinMenu
onresize=centerIt
</script>
<base target="newWin">
<div align="right"><a href="javascript:menu.expand()" target="_self">展开</a> | <a href="javascript:menu.contract()" target="_self">隐藏</a> | <a href="javascript:menu.stop()" target="_self">停止</a> | <a href="javascript:menu.rotate()" target="_self">旋转</a> | <a href="javascript:menu.changeDir()" target="_self">改变旋转方向</a></div>
<div class="spin"><a href="http://www.butong.net">网页特效库</a></div>
<div class="spin"><a href="http://www.butong.net/background/index.htm">背景特效</a></div>
<div class="spin"><a href="http://www.butong.net/moban/index.htm">整站模板</a></div>
<div class="spin"><a href="http://www.butong.net/navigation/index.htm">导航特效</a></div>
<div class="spin"><a href="http://www.butong.net/time/index.htm">时间特效</a></div>
<div class="spin"><a href="http://www.butong.net/img/index.htm">图象特效</a></div>
<div class="spin"><a href="http://www.butong.net/text/index.htm">文本特效</a></div> </body>
我只是一个大侠!

TOP

十六、网页左侧隐藏导航菜单~
复制内容到剪贴板
代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0046)[url]http://vip.aou.cn/csqf/new_page_3.htm[/url] -->
<HTML><HEAD><TITLE>New Page 28</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1491" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId>
<STYLE>#ssm2 A {
FONT-SIZE: 12px; COLOR: #808080; FONT-FAMILY: verdana; TEXT-DECORATION: none
}
#ssm2 A:hover {
COLOR: #ccff33
}
body{background:url([img]http://www.infowe.com/images/infowe.gif[/img]) no-repeat right center fixed;}
</STYLE>
</HEAD>
<BODY>
<SCRIPT language=JavaScript1.2>
function MM_displayStatusMsg(msgStr) {
status=msgStr;
document.MM_returnValue = true;
}
function highlight(x){
document.forms[x].elements[0].focus()
document.forms[x].elements[0].select()
}
function MM_jumpMenu(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
var NS
IE=document.all;
NS=document.layers;
hdrFontFamily="Verdana";
hdrFontSize="2";
hdrFontColor="white";
hdrBGColor="#CCCCCC";
linkFontFamily="Verdana";
linkFontSize="2";
linkBGColor="white";
linkOverBGColor="#CCCCCC";
linkTarget="_top";
YOffset=60;
staticYOffset=20;
menuBGColor="#CCCCCC";
menuIsStatic="no";
menuHeader="Main Index"
menuWidth=150; // Must be a multiple of 5!
staticMode="advanced"
barBGColor="#C0C0C0";
barFontFamily="Verdana";
barFontSize="2";
barFontColor="white";
barText="MENU";
function moveOut() {
if (window.cancel) {
cancel="";
}
if (window.moving2) {
clearTimeout(moving2);
moving2="";
}
if ((IE && ssm2.style.pixelLeft<0)||(NS && document.ssm2.left<0)) {
if (IE) {ssm2.style.pixelLeft += (5%menuWidth);
}
if (NS) {
document.ssm2.left += (5%menuWidth);
}
moving1 = setTimeout('moveOut()', 5)
}
else {
clearTimeout(moving1)
}
};
function moveBack() {
cancel = moveBack1()
}
function moveBack1() {
if (window.moving1) {
clearTimeout(moving1)
}
if ((IE && ssm2.style.pixelLeft>(-menuWidth))||(NS && document.ssm2.left>(-150))) {
if (IE) {ssm2.style.pixelLeft -= (5%menuWidth);
}
if (NS) {
document.ssm2.left -= (5%menuWidth);
}
moving2 = setTimeout('moveBack1()', 5)}
else {
clearTimeout(moving2)
}
};
lastY = 0;
function makeStatic(mode) {
if (IE) {winY = document.body.scrollTop;var NM=ssm2.style
}
if (NS) {winY = window.pageYOffset;var NM=document.ssm2
}
if (mode=="smooth") {
if ((IE||NS) && winY!=lastY) {
smooth = .2 * (winY - lastY);
if(smooth > 0) smooth = Math.ceil(smooth);
else smooth = Math.floor(smooth);
if (IE) NM.pixelTop+=smooth;
if (NS) NM.top+=smooth;
lastY = lastY+smooth;
}
setTimeout('makeStatic("smooth")', 1)
}
else if (mode=="advanced") {
if ((IE||NS) && winY>YOffset-staticYOffset) {
if (IE) {NM.pixelTop=winY+staticYOffset
}
if (NS) {NM.top=winY+staticYOffset
}
}
else {
if (IE) {NM.pixelTop=YOffset
}
if (NS) {NM.top=YOffset-7
}
}
setTimeout('makeStatic("advanced")', 1)
}
}
function init() {
if (IE) {
ssm2.style.pixelLeft = -menuWidth;
ssm2.style.visibility = "visible"
}
else if (NS) {
document.ssm2.left = -menuWidth;
document.ssm2.visibility = "show"
}
else {
alert('Choose either the "smooth" or "advanced" static modes!')
}
}
function MM_displayStatusMsg(msgStr) {
status=msgStr;
document.MM_returnValue = true;
}
</SCRIPT>
<SCRIPT language=JavaScript1.2>
if (IE) {document.write('<DIV ID="ssm2" style="visibility:hidden;Position : Absolute ;Left : 0px ;Top : '+YOffset+'px ;Z-Index : 20;width:1px" onmouseover="moveOut()" onmouseout="moveBack()">')}
if (NS) {document.write('<LAYER visibility="hide" top="'+YOffset+'" name="ssm2" bgcolor="'+menuBGColor+'" left="0" onmouseover="moveOut()" onmouseout="moveBack()">')}
tempBar=""
for (i=0;i<barText.length;i++) {
tempBar+=barText.substring(i, i+1)+"<BR>"}
document.write('<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+16+2)+'" bgcolor="'+menuBGColor+'"><tr><td bgcolor="'+hdrBGColor+'" WIDTH="'+menuWidth+'"> <font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+menuHeader+'</b></font></td><td align="center" rowspan="100" width="16" bgcolor="'+barBGColor+'"><p align="center"><font face="'+barFontFamily+'" Size="'+barFontSize+'" COLOR="'+barFontColor+'"><B>'+tempBar+'</B></font></p></TD></tr>')
function addItem(text, link, target) {
if (!target) {target=linkTarget}
document.write('<TR><TD BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'"> <A HREF="'+link+'" target="'+target+'" CLASS="ssm2Items">'+text+'</A></FONT></LAYER></ILAYER></TD></TR>')}
function addHdr(text) {
document.write('<tr><td bgcolor="'+hdrBGColor+'" WIDTH="140"> <font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+text+'</b></font></td></tr>')}
//Only edit the script between HERE
addItem('偶和叶子', 'http://vip.aou.cn/csqf/about.htm', '');
addItem('聆听心海', 'http://vip.aou.cn/csqf/linting.htm', '');
addItem('风言风语', 'http://vip.aou.cn/csqf/fyfy.htm', '');
addItem('风行风影', 'http://vip.aou.cn/csqf/fxfy.htm', '');
addItem('雁过留声', 'http://csqf.etp21.com/', '_blank');
addHdr('WELCOME TO');
addItem('经广俱乐部', 'http://dj973.tz315.net', '_blank');
// and HERE! No more!
document.write('<tr><td bgcolor="'+hdrBGColor+'"><font size="0" face="Arial"> </font></td></TR></table>')
if (IE) {document.write('</DIV>')}
if (NS) {document.write('</LAYER>')}
if ((IE||NS) && (menuIsStatic=="yes"&&staticMode)) {makeStatic(staticMode);}
</SCRIPT>
<SCRIPT>
window.onload=init
</SCRIPT>
<p style="height:1000px;"></p>
</BODY></HTML>
我只是一个大侠!

TOP

十七、焦点图片模糊变化切换效果
复制内容到剪贴板
代码:
<script language="JavaScript1.1">
<!--
var slidespeed=3000
var slideimages=new Array("http://www.makewing.com/lanren/jscode/js-0079/images/01.jpg","http://www.makewing.com/lanren/jscode/js-0079/images/02.jpg","http://www.makewing.com/lanren/jscode/js-0079/images/03.jpg","http://www.makewing.com/lanren/jscode/js-0079/images/04.jpg")
var slidelinks=new Array("#","#","#","#")

var imageholder=new Array()
var ie55=window.createPopup
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
window.location=slidelinks[whichlink]
}
//-->
</script>
<a href="javascript:gotoshow()"><img src="photo/200202261.jpg" name="slide" border=0 style="filter:progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=15,Duration=1)"></a>
<script language="JavaScript1.1">
<!--
var whichlink=0
var whichimage=0
var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0
function slideit(){
if (!document.images) return
if (ie55) document.images.slide.filters[0].apply()
document.images.slide.src=imageholder[whichimage].src
if (ie55) document.images.slide.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
setTimeout("slideit()",slidespeed+pixeldelay)
}
slideit()
//-->
</script>
我只是一个大侠!

TOP

十八、框架自定义
复制内容到剪贴板
代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>框架自定义拖拽</title>
<style>
body {
        margin:0px;
        padding:0px;
        font-size:12px;
        text-align:center;
}
body > div {
        text-align:center;
        margin-right:auto;
        margin-left:auto;
}
.content {
        width:900px;
}
.content .left {
        float:left;
        width:20%;
        border:1px solid #FF0000;
        margin:3px;
}
.content .center {
        float:left;
        border:1px solid #FF0000;
        margin:3px;
        width:57%
}
.content .right {
        float:right;
        width:20%;
        border:1px solid #FF0000;
        margin:3px
}
.mo {
        height:auto;
        border:1px solid #CCC;
        margin:3px;
        background:#FFF
}
.mo h1 {
        background:#ECF9FF;
        height:18px;
        padding:3px;
        cursor:move
}
.mo .nr {
        height:80px;
        border:1px solid #F3F3F3;
        margin:2px
}
h1 {
        margin:0px;
        padding:0px;
        text-align:left;
        font-size:12px
}
</style>
<script>
var dragobj={}
window.onerror=function(){return false}
function on_ini(){
String.prototype.inc=function(s){return this.indexOf(s)>-1?true:false}
var agent=navigator.userAgent
window.isOpr=agent.inc("Opera")
window.isIE=agent.inc("IE")&&!isOpr
window.isMoz=agent.inc("Mozilla")&&!isOpr&&!isIE
if(isMoz){
  Event.prototype.__defineGetter__("x",function(){return this.clientX+2})
  Event.prototype.__defineGetter__("y",function(){return this.clientY+2})
}
basic_ini()
}
function basic_ini(){
window.$=function(obj){return typeof(obj)=="string"?document.getElementById(obj):obj}
window.oDel=function(obj){if($(obj)!=null){$(obj).parentNode.removeChild($(obj))}}
}
window.onload=function(){
on_ini()
var o=document.getElementsByTagName("h1")
for(var i=0;i<o.length;i++){
  o[i].onmousedown=function(e){
   if(dragobj.o!=null)
    return false
   e=e||event
   dragobj.o=this.parentNode
   dragobj.xy=getxy(dragobj.o)
   dragobj.xx=new Array((e.x-dragobj.xy[1]),(e.y-dragobj.xy[0]))
   dragobj.o.style.width=dragobj.xy[2]+"px"
   dragobj.o.style.height=dragobj.xy[3]+"px"
   dragobj.o.style.left=(e.x-dragobj.xx[0])+"px"
   dragobj.o.style.top=(e.y-dragobj.xx[1])+"px"   
   dragobj.o.style.position="absolute"
   var om=document.createElement("div")
   dragobj.otemp=om
   om.style.width=dragobj.xy[2]+"px"
   om.style.height=dragobj.xy[3]+"px"
   dragobj.o.parentNode.insertBefore(om,dragobj.o)
   return false
  }
}
}
document.onselectstart=function(){return false}
window.onfocus=function(){document.onmouseup()}
window.onblur=function(){document.onmouseup()}
document.onmouseup=function(){
if(dragobj.o!=null){
  dragobj.o.style.width="auto"
  dragobj.o.style.height="auto"
  dragobj.otemp.parentNode.insertBefore(dragobj.o,dragobj.otemp)
  dragobj.o.style.position=""
  oDel(dragobj.otemp)
  dragobj={}
}
}
document.onmousemove=function(e){
e=e||event
if(dragobj.o!=null){
  dragobj.o.style.left=(e.x-dragobj.xx[0])+"px"
  dragobj.o.style.top=(e.y-dragobj.xx[1])+"px"
  createtmpl(e)
}
}
function getxy(e){
var a=new Array()
var t=e.offsetTop;
var l=e.offsetLeft;
var w=e.offsetWidth;
var h=e.offsetHeight;
while(e=e.offsetParent){
  t+=e.offsetTop;
  l+=e.offsetLeft;
}
a[0]=t;a[1]=l;a[2]=w;a[3]=h
  return a;
}
function inner(o,e){
var a=getxy(o)
if(e.x>a[1]&&e.x<(a[1]+a[2])&&e.y>a[0]&&e.y<(a[0]+a[3])){
  if(e.y<(a[0]+a[3]/2))
   return 1;
  else
   return 2;
}else
  return 0;
}
function createtmpl(e){
for(var i=0;i<12;i++){
  if($("m"+i)==dragobj.o)
   continue
  var b=inner($("m"+i),e)
  if(b==0)
   continue
  dragobj.otemp.style.width=$("m"+i).offsetWidth
  if(b==1){
   $("m"+i).parentNode.insertBefore(dragobj.otemp,$("m"+i))
  }else{
   if($("m"+i).nextSibling==null){
    $("m"+i).parentNode.appendChild(dragobj.otemp)
   }else{
    $("m"+i).parentNode.insertBefore(dragobj.otemp,$("m"+i).nextSibling)
   }
  }
  return
}
for(var j=0;j<3;j++){
  if($("dom"+j).innerHTML.inc("div")||$("dom"+j).innerHTML.inc("DIV"))
   continue
  var op=getxy($("dom"+j))
  if(e.x>(op[1]+10)&&e.x<(op[1]+op[2]-10)){
   $("dom"+j).appendChild(dragobj.otemp)
   dragobj.otemp.style.width=(op[2]-10)+"px"
  }
}
}
</script>
</head>
<body>
<div class=content>
  <div class=left id=dom0>
    <div class=mo id=m0>
      <h1>dom0</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m1>
      <h1>dom1</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m2>
      <h1>dom2</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m3>
      <h1>dom3</h1>
      <div class="nr"></div>
    </div>
  </div>
  <div class=center id=dom1>
    <div class=mo id=m4>
      <h1>dom4</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m5>
      <h1>dom5</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m6>
      <h1>dom6</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m7>
      <h1>dom7</h1>
      <div class="nr"></div>
    </div>
  </div>
  <div class=right id=dom2>
    <div class=mo id=m8>
      <h1>dom8</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m9>
      <h1>dom9</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m10>
      <h1>dom10</h1>
      <div class="nr"></div>
    </div>
    <div class=mo id=m11>
      <h1>dom11</h1>
      <div class="nr"></div>
    </div>
  </div>
</div>
</body>
</html>
我只是一个大侠!

TOP

十九、静态页面的分页效果
复制内容到剪贴板
代码:
<style>
* {
  font-size:10.2pt;
  font-family:tahoma;
  line-height:150%;
}
.divContent
{
  border:1px solid red;
  background-color:#FFD2D3;
  width:500px;
  word-break:break-all;
  margin:10px 0px 10px;
  padding:10px;
}
</style>

header
<div id="divPagenation"></div>
<div id="divContent"></div>
footer
<script language="jscript">
<!--
s="<p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p>";
function DHTMLpagenation(content) { with (this)
{
  // client static html file pagenation

  this.content=content;
  this.contentLength=content.length;
  this.pageSizeCount;
  this.perpageLength=100; //default perpage byte length.
  this.currentPage=1;
  //this.regularExp=/.+[\?\&]page=(\d+)/;
  this.regularExp=/\d+/;

  this.divDisplayContent;
  this.contentStyle=null;
  this.strDisplayContent="";
  this.divDisplayPagenation;
  this.strDisplayPagenation="";
  
  arguments.length==2?perpageLength=arguments[1]:'';

  try {
    divExecuteTime=document.createElement("DIV");
    document.body.appendChild(divExecuteTime);
  }
  catch(e)
  {
  }
  if(document.getElementById("divContent"))
  {
    divDisplayContent=document.getElementById("divContent");
  }
  else
  {
    try
    {
      divDisplayContent=document.createElement("DIV");
      divDisplayContent.id="divContent";
      document.body.appendChild(divDisplayContent);
    }
    catch(e)
    {
      return false;
    }
  }

  if(document.getElementById("divPagenation"))
  {
    divDisplayPagenation=document.getElementById("divPagenation");
  }
  else
  {
    try
    {
      divDisplayPagenation=document.createElement("DIV");
      divDisplayPagenation.id="divPagenation";
      document.body.appendChild(divDisplayPagenation);
    }
    catch(e)
    {
      return false;
    }
  }

  DHTMLpagenation.initialize();
  return this;
  
}};
DHTMLpagenation.initialize=function() { with (this)
{
  divDisplayContent.className=contentStyle!=null?contentStyle:"divContent";
  if(contentLength<=perpageLength)
  {
    strDisplayContent=content;
    divDisplayContent.innerHTML=strDisplayContent;
    return null;
  }

  pageSizeCount=Math.ceil((contentLength/perpageLength));

  DHTMLpagenation.goto(currentPage);
  DHTMLpagenation.displayContent();
}};
DHTMLpagenation.displayPage=function() { with (this)
{
  strDisplayPagenation="分页:";

  if(currentPage&&currentPage!=1)
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.previous()">上一页</a>&nbsp;&nbsp;';
  else
    strDisplayPagenation+="上一页&nbsp;&nbsp;";

  for(var i=1;i<=pageSizeCount;i++)
  {
    if(i!=currentPage)
      strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.goto('+i+');">'+i+'</a>&nbsp;&nbsp;';
    else
      strDisplayPagenation+=i+"&nbsp;&nbsp;";
  }

  if(currentPage&&currentPage!=pageSizeCount)
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.next()">下一页</a>&nbsp;&nbsp;';
  else
    strDisplayPagenation+="下一页&nbsp;&nbsp;";

  strDisplayPagenation+="共 " + pageSizeCount + " 页,每页" + perpageLength + " 字符,调整字符数:<input type='text' value='"+perpageLength+"' id='ctlPerpageLength'><input type='button' value='确定' onclick='DHTMLpagenation.change(document.getElementById(\"ctlPerpageLength\").value);'>";

  divDisplayPagenation.innerHTML=strDisplayPagenation;
}};
DHTMLpagenation.previous=function() { with(this)
{
  DHTMLpagenation.goto(currentPage-1);
}};
DHTMLpagenation.next=function() { with(this)
{
  DHTMLpagenation.goto(currentPage+1);
}};
DHTMLpagenation.goto=function(iCurrentPage) { with (this)
{
  startime=new Date();
  if(regularExp.test(iCurrentPage))
  {
    currentPage=iCurrentPage;
    strDisplayContent=content.substr((currentPage-1)*perpageLength,perpageLength);
  }
  else
  {
    alert("page parameter error!");
  }
  DHTMLpagenation.displayPage();
  DHTMLpagenation.displayContent();
}};
DHTMLpagenation.displayContent=function() { with (this)
{
  divDisplayContent.innerHTML=strDisplayContent;
}};
DHTMLpagenation.change=function(iPerpageLength) { with(this)
{
  if(regularExp.test(iPerpageLength))
  {
    DHTMLpagenation.perpageLength=iPerpageLength;
    DHTMLpagenation.currentPage=1;
    DHTMLpagenation.initialize();
  }
  else
  {
    alert("请输入数字");
  }
}};

// method
// DHTMLpagenation(strContent,perpageLength)

DHTMLpagenation(s,100);

//-->
</script>
我只是一个大侠!

TOP

二十、客齐集社区头像效果CSS解析
复制内容到剪贴板
代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>zishu.cn test</title>
<style>
body{ font-size:12px; line-height:1.8; font-family:Verdana, "宋体", Arial,Sans; text-align:center; background:#FFF; color:#666; margin:50px; padding:0; list-style:none; }
a:link,a:visited{color:#000099; text-decoration: underline;}
a:hover,a:active{color:#000;text-decoration: none;}
#zishu_test li{ float:left; width:14%;text-align:center; margin:0 auto; list-style:none }
#zishu_test li a{border-right:1px solid #fff;border-bottom:1px solid #fff; width:100px; height:110px; background:#fff;display:block; padding-top:10px; margin:auto}
#zishu_test li img{ width:75px; height:75px; display:block; text-align:center; margin:auto; background:#FFF; padding:3px; border:1px solid #D8A18B;}
#zishu_test li span{display:none;}
#zishu_test li a:hover span{ margin-top:-10px;display:block; border-bottom:1px solid #666; border-right:1px solid #666; background:#FA9000; width:100px; color:#FFF; position:absolute; }
* html #zishu_test li a:hover span {margin-left:-8px; } /* IE6 */
*+html #zishu_test li a:hover span {margin-left:-8px; }/* IE7*/
#zishu_test li a:hover{ border-right:1px solid #D8A18B;border-bottom:1px solid #D8A18B; width:100px; height:110px; background:#F5F5F5;display:block; padding-top:10px;}
</style>
</head>
<body>
<div id="zishu_test">
  <ul>
    <li><a href="http://yy.kijiji.cn/u/秀才"><span>64d / 47 hits</span><img src="http://yy.kijiji.cn/img/p/10000009.jpg">pixu</a></li>
    <li><a href="http://yy.kijiji.cn/u/秀才"><span>24d / 35 hits</span><img src="http://yy.kijiji.cn/img/p/294343.jpg">秀才</a></li>
    <li><a href="http://yy.kijiji.cn/u/秀才"><span>66d / 87 hits</span><img src="http://yy.kijiji.cn/img/p/10000010.jpg">透露</a></li>
    <li><a href="http://yy.kijiji.cn/u/秀才"><span>40d / 34 hits</span><img src="http://yy.kijiji.cn/img/p/11709126.jpg">LIVID</a></li>
    <li><a href="http://yy.kijiji.cn/u/秀才"><span>47d / 56 hits</span><img src="http://yy.kijiji.cn/img/p/10000002.jpg">老孟</a></li>
    <li><a href="http://yy.kijiji.cn/u/秀才"><span>42d / 36hits</span><img src="http://yy.kijiji.cn/img/p/11695932.jpg">小玉</a></li>
    <li><a href="http://yy.kijiji.cn/u/秀才"><span>63d / 67 hits</span><img src="http://yy.kijiji.cn/img/p/10000025.jpg">pixu</a></li>
  </ul>
</div>
</body>
</html>
我只是一个大侠!

TOP

 16 12
发新话题