星辰 发表于 2007 年 7 月 11 日 15:04:49

几个小代码!

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>仿蓝色理想网站的导航菜单</title>
</head>
<style type="text/css">
#dNavBar{
background-color:#ffffff;
}
#dNavBar li{
list-style-type:none;
float:left;
width:84px;
height:28px;
line-height:28px;
font-size:12px;
color:#FFFFFF;
border:3px solid #ffffff;
background-color:#86C2FF;
text-align:center;
display:block;
cursor:pointer;
}
#subMenu{
background-color:#0000FF;
width:500px;
border-left:3px solid #ffffff;
border-right:3px solid #ffffff;
height:29px;
line-height:29px;
color:#FFFFFF;
font-size:12px;
padding-left:10px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:hover{
color: #FFFFFF;
text-decoration: none;
}
a:visited{
color: #FFFFFF;
text-decoration: none;
}
</style>
<script language="javascript">
function ShowMenu()
{
var barCTT=document.getElementById("dNavBar")
var liArr=barCTT.getElementsByTagName("li")
var links=new Array()
links="<a href='#'>当前位置:首页"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a> | <a href='#'>项目三</a> | <a href='#'>项目四</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a> | <a href='#'>项目三</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a> | <a href='#'>项目三</a> | <a href='#'>项目四</a> | <a href='#'>项目五</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a> | <a href='#'>项目三</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a>"
links="<a href='#'>项目一</a>| <a href='#'>项目二</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a>"
links="<a href='#'>项目一</a> | <a href='#'>项目二</a>"
for (i=0;i<liArr.length;i++)
{
liArr.onclick=function()
{
selectThis(this,liArr,links)
}
}
}
function selectThis(indexObj,allLi,infoArr)
{
var index=0;
for (i=0;i<allLi.length;i++)
{
allLi.style.border="3px solid #ffffff";
allLi.style.backgroundColor="#86C2FF";
allLi.style.height="28px";
if (indexObj==allLi)
{
index=i;
}
}
indexObj.style.borderBottom="0px solid #666688";
indexObj.style.backgroundColor="#0000FF";
indexObj.style.height="31px";
document.getElementById("subMenu").innerHTML=infoArr;
}
</script>
<body onLoad="ShowMenu()">
<div id="dNavBar" style="float:none; width:560px;"><li>首页</li><li>娱乐快报</li><li>音乐天地</li><li>极品FLASH</li>
</div>
<div id="subMenu">站务公告</div>
</body>
</html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>模仿Flash AS效果的导航菜单</title>
<style type="text/css">
<!--
a:link,a:visited { text-decoration: none; color: #666666 }
a:hover { text-decoration: underline }
#hor1 {
position:absolute;
left:320px;
top:20px;
width:220px;
height:20px;
z-index:1;
background-color: #999900;
}
#hor2 {
position:absolute;
left:320px;
top:40px;
width:220px;
height:20px;
z-index:2;
background-color: #FFCC00;
}
#hor3 {
position:absolute;
left:320px;
top:60px;
width:220px;
height:20px;
z-index:3;
background-color: #99CC00;
}
#board1 {
position:absolute;
left:320px;
top:40px;
width:220px;
height:120px;
z-index:-100;
background-color: #333333;
visibility: hidden;
}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
font-weight: bold;
}
body {
background-color: #666666;
}
#board2 {
position:absolute;
left:320px;
top:60px;
width:220px;
height:120px;
z-index:-90;
background-color: #333333;
visibility: hidden;
}
#board3 {
position:absolute;
width:220px;
height:120px;
z-index:-80;
left: 320px;
top: 80px;
background-color: #333333;
visibility: hidden;
}
#hor4 {
position:absolute;
left:320px;
top:80px;
width:220px;
height:20px;
z-index:4;
background-color: #99CCCC;
}
#board4 {
position:absolute;
left:320px;
top:100px;
width:220px;
height:120px;
z-index:-70;
background-color: #333333;
visibility: hidden;
}

-->
</style>
<script type="text/javascript">
lastNo=0
function re(menu_no){
if(lastNo!=menu_no){
cur=menu_no+1
lastNo=menu_no
rest()
}else{
cur=100
}
document.getElementById("board"+menu_no).style.visibility="visible"
}
function rest(){
for(i=1;i<=4;i++){
document.getElementById("hor"+i).style.top=20*i;
document.getElementById("board"+i).style.visibility="hidden"
}
menu_num=4;
act=1
height=120+20
speed=0;
posY=0;
}
function huke(){
if(act==1&&cur<100){
speed=(height-posY)*0.69+speed*0.6
posY+=speed
for(i=cur;i<=menu_num;i++){
document.getElementById("hor"+i).style.top=posY+(i-2)*20
}
if(Math.abs(height-posY)<0.5){
for(i=cur;i<=menu_num;i++){
document.getElementById("hor"+i).style.top=height+(i-2)*20
}
act=0
}
setTimeout("huke()",50)
}
}

</script>
</head>
<body>
<div id="hor1" onclick="re(1);huke()">News</div>
<div id="hor2" onclick="re(2);huke()">Populor</div>
<div id="hor3" onclick="re(3);huke()">Sports</div>
<div id="hor4" onclick="re(4);huke()">Woman</div>
<div id="board1">1.由AS而想起Javascript2.用Jscript写ASP有没有先天性的不足?3.没有了。</div>
<div id="board2">1.xhtml+css真的来了吗?2.Flash取代传统网站3.Flash何时才能连接数据库?</div>
<div id="board3">1.程序员与小姐的10个相同。2.中国的程序员与中国的足球?</div>
<div id="board4">1.二十一世纪最缺的是什么?人才
<a href="http://linkweb.cn/js" target="_blank">http://linkweb.cn/js</a></div>
</body>
</html>

星辰 发表于 2007 年 7 月 11 日 15:07:10

<html>

<head>

<title>类似于Flash制作的一个图片展示效果</title>


<meta http-equiv="imagetoolbar" content="no">

<style type="text/css">

body {cursor:crosshair;margin:0; padding:0; position:absolute; overflow:hidden; background:#222; left:0; top:0; width:100%; height:100%;zIndex:-2;}

</style>

<base href=http://www.phpfans.net//jscode/>

<script type="text/javascript">

window.onerror = new Function("return true");

screen.bufferDepth = 16;

document.onselectstart = function () { return false; }



////////////////////////////

var NX   = 3;

var NY   = 3;

var SP   = 20;

var DELAY= 96;

////////////////////////////



var object = new Array();

var nI   = 0;

var run    = false;

var xrun   = 0;

var dR   = 1;

var iW   = 0;

var iH   = 0;

var oH   = 0;

var oW   = 0;



function CObj(N,y,x){



this.obj = document.createElement("span");

this.obj.onclick = new Function("object["+N+"].GE1()");

this.obj.onmousedown = new Function("return false;");

this.obj.style.cursor = "pointer";

this.obj.style.position = "absolute";

this.img = document.createElement("img");

this.img.style.position = "absolute";

this.img.src = IMGSRC.src;

this.obj.appendChild(this.img);

IMGBOX.appendChild(this.obj);



this.object = new Array();

this.x      = x;

this.y      = y;

this.N      = N;

this.W      = 0;

this.H      = 0;

this.L      = 0;

this.T      = 0;



function CImg(Parent,y,x){

this.Parent = Parent;



this.obj = document.createElement("span");

this.obj.style.position="absolute";

this.obj.style.overflow="hidden";

this.obj.style.cursor = "pointer";

this.img = document.createElement("img");

this.img.style.position = "absolute";

this.img.src = IMGSRC.src;

this.obj.appendChild(this.img);

this.Parent.obj.appendChild(this.obj);



this.N   = Parent.N;

this.x   = x;

this.y   = y;

this.W   = 0;

this.H   = 0;

this.L   = 0;

this.T   = 0;

this.dx= 0;

this.dy= 0;

this.px= 0;

this.py= 0;

this.dw= 0;

this.dh= 0;

this.pw= 0;

this.ph= 0;

this.ipx = 0;

this.ipy = 0;

this.idx = 0;

this.idy = 0;



this.GE2 = function (){

   with(this){

    px -= dx * dR;

    py -= dy * dR;

    pw += dw * dR;

    ph += dh * dR;

    ipx -= idx * dR;

    ipy -= idy * dR;



    with(obj.style){

   left   = Math.round(px);

   top    = Math.round(py);

   width= Math.round(pw)+1;

   height = Math.round(ph)+1;

   if(dR==-1)if(pw<=W+1)obj.style.visibility="hidden";

    }



    with(img.style){

   left   = Math.round(ipx-oW);

   top    = Math.round(ipy-oH);

    }



    if(++xrun>=NX*NY*SP){

   xrun=0;

   run=false;

   if(dR==-1)Parent.obj.style.zIndex = 0;

   dR = -dR;

    }

   }

}



this.GE1 = function (N1,N2){

   with(this){

    if(dR==1){

   px= L;

   py= T;

   dx= ((Parent.L + L) - (x * Parent.W)) / SP;

   dy= ((Parent.T + T) - (y * Parent.H)) / SP;

   pw= W;

   ph= H;

   dw= (Parent.W - W) / SP;

   dh= (Parent.H - H) / SP;

   ipx = -L;

   ipy = -T;

   idx = ((x * Parent.W) - L) / SP;

   idy = ((y * Parent.H) - T) / SP;

    }

    obj.style.visibility="visible";

    if(img.height>document.body.offsetHeight)oH=(img.height-document.body.offsetHeight)/2; else oH = 0;

    if(img.width>document.body.offsetWidth/2)oW=(img.width-(document.body.offsetWidth/2))/2; else oW = 0;

    for(i=0;i<SP;i++) setTimeout("object["+N1+"].object["+N2+"].GE2()",16*i);

   }

}



this.DOOT = function (){

   with(this){

    W =Parent.W/ NX;

    H =Parent.H / NY;

    L =x * W;

    T =y * H;

   }

}

}



vark = 0;

for(var i=0;i<NY;i++)

for(var j=0;j<NX;j++)

   this.object = new CImg(this,i,j);



this.GE1= function (){

with(this){

   if(!run){

    TXTBOX.innerHTML = "<div style='margin:2%'>"+TXTSRC.innerHTML+"</div>";

    run = true;

    obj.style.zIndex = 1;

    for(var i=0;i<NX*NY;i++) setTimeout("object["+N+"].object["+i+"].GE1("+N+","+i+")",i*DELAY);

   }

}

}



this.DOOT = function (){

with(this){

   if(img.width<iW)iW=img.width;

   if(img.height<iH)iH=img.height;

   with(obj.style){

    W = width= iW/ NX;

    H = height = iH / NY;

    L = left   = x * W;

    T = top    = y * H;

   }

   with(img.style){

    width= W;

    height = H;

   }

   for(var i in object) object.DOOT();

}

}

}





onload = function() {

IMGSRC = document.getElementById("imgsrc").getElementsByTagName("img");

TXTSRC = document.getElementById("txtsrc").getElementsByTagName("div");

IMGBOX = document.getElementById("imgbox");

TXTBOX = document.getElementById("txtbox");

CENTER = document.getElementById("center");

iH = document.body.offsetHeight;

iW = document.body.offsetWidth/2;

nI = IMGSRC.length;

var k = 0;

for(var i=0;i<NY;i++){

for(var j=0;j<NX;j++){

   object = new CObj(k,i,j);

   object.DOOT();

}

}

IMGBOX.style.width= iW;

IMGBOX.style.height = iH;

TXTBOX.style.width= iW;

TXTBOX.style.height = iH;

TXTBOX.style.left   = iW;

TXTBOX.style.visibility="visible";

CENTER.style.left   = -iW;

CENTER.style.top    = -iH/2;

}

//-->

</script>

</head>



<body>

<div style="position:absolute;left:50%;top:50%;"><div id="center" style="position:absolute;">



<div id="imgbox" style="position:absolute;left:0;top:0;overflow:hidden;"></div>

<div id="txtbox" style="position:absolute;visibility:hidden;overflow:hidden;background:#333;color:#FFF;font-family:verdana;font-size:0.8em;">

<div style="margin:2%">

<h2>IMGBOX</h2>Click the thumbnails on the left for a larger image. The description connected to the clicked image is displayed here.<br>

<br>Note: for performance reasons, images are not resized and must be all of the same size.

</div>

</div>





</div></div>



<div id="imgsrc" style="visibility:hidden">

<img src="/jscode/images/20065115756894.jpg">

<img src="/jscode/images/20065115757878.jpg">

<img src="/jscode/images/2006511581166.jpg">

<img src="/jscode/images/2006511581185.jpg">

<img src="/jscode/images/2006511581187.jpg">

<img src="/jscode/images/2006511581588.jpg">

<img src="/jscode/images/2006511581828.jpg">

<img src="/jscode/images/2006511581951.jpg">

<img src="/jscode/images/2006511581821.jpg">

</div>



<div id="txtsrc" style="visibility:hidden">

<div>

<h2>the river</h2><br>Awaken from my nap by the river

</div>

<div>

<h2>transparency</h2><br>Its transparency was hypnotizing.

</div>

<div>

<h2>cold</h2><br>Currents of cold water played with light.

</div>

<div>

<h2>sank in</h2><br>I threw a few nuts into the river. They floated for a while, then sank in.

</div>

<div>

<h2>masked</h2><br>A wide stepping stone masked the water's depth.

</div>

<div>

<h2>a glimpse</h2><br>Later on, I had a glimpse of the river's bed.

</div>

<div>

<h2>forgotten</h2><br>The wheelchair made a noise. Again, I had forgotten about my legs.

</div>

<div>

<h2>floated</h2><br>Still, I floated in oblivion of things too real.

</div>

<div>

<h2>for me</h2><br>I stared fixedly at the water's open arms. The stream was singing for me.

</div>

</div>



<!-- crossbrowser images_loading_bar - Gerard Ferrandez - www.dhteumeuleu.com - Feb 2005 -->

<span id=LB0 style="position:absolute;left:50%;top:50%;"><span style="position:absolute;font-family:arial;font-size:10px;color:#FFFFFF;left:-50;top:-18">Loading...</span>

<span style="position:absolute;left:-50;top:-5;font-size:1px;width:100;height:10px;background:#333"><span id=LB1 style="position:absolute;left:0;top:0;font-size:1px;width:0;height:10px;background:#FFFFFF"></span></span></span>

<script>m00=document.getElementById("imgsrc").getElementsByTagName("img");m01=m00.length;function images_loading_bar(){m02=0;for(i=0;i<m01;i++)m02+=(m00.complete)?1:0;document.getElementById("LB1").style.width=Math.round(m02/m01*100);if(m02==m01)setTimeout("document.getElementById('LB0').style.display='none'",128); else setTimeout("images_loading_bar()", 64);};images_loading_bar();</script>

<!-- end of images_loading_bar code -->



</body>

</html>

星辰 发表于 2007 年 7 月 11 日 15:07:44

<html>
<head>
<title>随日期变换的文本</title>
<style type="text/css">
<!--
body {font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 4px; margin-right: 0px}
A { FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
--></style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>
<body>
<br>
<br>
<center><font color=red face="隶书" size=6>随日期变换文本</font></center>
<br>
<center>
<table border=1 bordercolor=#000000 borderlight=green style="border-collapse: collapse" cellpadding="0" cellspacing="0">
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面为脚本显示区</strong></font></td></tr><tr><td align=center><script language="JavaScript">
<!-- Hide
var now = new Date();
var month = now.getMonth() + 1;
var date = now.getDate();
var year = now.getYear();

      msgs = new Array
      msgs = "每月1号的信息:"
      msgs = "每月2号的信息:"
      msgs = "每月3号的信息:"
      msgs = "每月4号的信息:"
      msgs = "每月5号的信息:"
      msgs = "每月6号的信息:"
      msgs = "每月7号的信息:"
      msgs = "每月8号的信息:"
      msgs = "每月9号的信息:"
      msgs = "每月10号的信息:"
      msgs = "每月11号的信息:"
      msgs = "每月12号的信息:"
      msgs = "每月13号的信息:"
      msgs = "每月14号的信息:"
      msgs = "每月15号的信息:"
      msgs = "每月16号的信息:"
      msgs = "每月17号的信息:"
      msgs = "每月18号的信息:"
      msgs = "每月19号的信息:"
      msgs = "每月20号的信息:"
      msgs = "每月21号的信息:"
      msgs = "每月22号的信息:"
      msgs = "每月23号的信息:"
      msgs = "每月24号的信息:"
      msgs = "每月25号的信息:"
      msgs = "每月26号的信息:"
      msgs = "每月27号的信息:"
      msgs = "每月28号的信息:"
      msgs = "每月29号的信息:"
      msgs = "每月30号的信息:"
      msgs = "每月31号的信息:"
      var msg = msgs

//-->

</script>
                  <script>
<!--
document.write(msg);
//-->
</script>
 </td></tr></table></center>
<br>
<br>
<center>
<SCRIPT LANGUAGE="JavaScript">

<!-- hide

function goHist(a)

{

   history.go(a);

}

//-->

</script></center>

</body>
</html>

风之翼灵 发表于 2007 年 7 月 11 日 15:07:50

是啥代码呀?

Python 发表于 2007 年 7 月 11 日 16:59:46

这些是干什么用的。。
页: [1]
查看完整版本: 几个小代码!