网页设计常用代码荟萃

      网络记忆 2004-9-16 17:40
禁止页面正文选取
<body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()">

消除ie6自动出现的图像工具栏,设置 GALLERYIMG属性为false或no .
<IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">

防止点击空链接时,页面往往重置到页首端。
代码“javas cript:void(null)”代替原来的“#”标记

如何避免别人把你的网页放在框架中
<s cript language=“javas cript”><!--if (self!=top){top.location=self.location;} -->< /s cript>

页面定时刷新
<meta http-equiv="Refresh" content="秒" >

页面定时转向新的地址
<meta http-equiv="refresh" content="秒;URL=url">

显示日期
<s cript language="javas cript"><!--
today=new Date();
var week; var date;
if(today.getDay()==0) week="星期日"
if(today.getDay()==1) week="星期一"
if(today.getDay()==2) week="星期二"
if(today.getDay()==3) week="星期三"
if(today.getDay()==4) week="星期四"
if(today.getDay()==5) week="星期五"
if(today.getDay()==6) week="星期六"
date=(today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日"+" "
document.write("<span style='font-size: 9pt;'>"+date+week+"</span>");
// -->
</s cript>

设为首页
<A href=# onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('url');">设为首页</A>

添加收藏
<A href="javas cript:window.external.AddFavorite('url','title')"> 加入收藏夹</A>

关闭窗口,这个是不会弹出提示直接关的:
把如下代码加入<body>区域中
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
<s cript language="javas cript">function shutwin(){closes.Click();return;}</s cript>
<a href="javas cript:shutwin();">关闭本窗口</a>

随机图片:
把如下代码加入<body>区域中
<s cript language="javas cript"><!--
today=new Date();
jran=today.getTime();

function rnd() {

ia=9301;
ic=49297;
im=233280;

jran = (jran*ia+ic) % im;
return jran/(im*1.0);
};

function rand(number) {

return Math.ceil(rnd()*number);
};

document.write("<CENTER>");
for(i=1;i<=1;i++) {
myNum=(rand(10)); //改成你要随机显示的图片数;
if(myNum == 1) document.write("<img src='photo/back.jpg'>");
if(myNum == 2) document.write("<img src='photo/j2.gif'>"); //图片路径,可用http://
if(myNum == 3) document.write("<img src='photo/email.gif'>");
if(myNum == 4) document.write("<img src='photo/arrow.gif'>");
if(myNum == 5) document.write("<img src='photo/j2.gif'>");
if(myNum == 6) document.write("<img src='photo/email.gif'>");
if(myNum == 7) document.write("<img src='photo/arrow.gif'>");
if(myNum == 8) document.write("<img src='photo/j2.gif'>");
if(myNum == 9) document.write("<img src='photo/back.jpg'>");
if(myNum == 10) document.write("<img src='photo/email.gif'>");
else {
document.write();
}
};
document.write("</CENTER>");
//-->
</s cript>
其实改一改随机什么都行,也不一定在body中,随机css也行我喜欢在这里找代http://www.jzzy.com/

图片显隐效果
脚本说明:
把如下代码加入<body>区域中
<s cript language=javas cript>
// Flash Image Extension for Dreamwever ,by Yichun Yuan(dezone@sina.com)
nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
if (object != "[object]"){ //do this so I can take a string too
setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
return;
}
clearTimeout(nereidFadeTimers[object.sourceIndex]);
diff = destOp-object.filters.alpha.opacity;
direction = 1;
if (object.filters.alpha.opacity > destOp){
direction = -1;
}
delta=Math.min(direction*diff,delta);
object.filters.alpha.opacity+=direction*delta;
if (object.filters.alpha.opacity != destOp){
nereidFadeObjects[object.sourceIndex]=object;
nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
}
}
</s cript>
<a href=#><img src="photoshopcn.jpg" border=0 onMouseOut=nereidFade(this,50,10,5) onMouseOver=nereidFade(this,100,10,5) style="FILTER: alpha(opacity=40)"></a>

推拉式菜单
<head>和〈/head>之间:<style>#D1 {
BACKGROUND-COLOR: lightblue;
BORDER-BOTTOM: white 2px outset;
BORDER-LEFT: white 2px outset;
BORDER-RIGHT: white 2px outset;
BORDER-TOP: white 2px outset; LEFT: 0px;
POSITION: absolute; TOP: 70px; VISIBILITY: hidden;
WIDTH: 200px; layer-background-color: lightblue
}
</style>
<s cript language="javas cript">
function menuIn() {
if(n4) {
clearTimeout(out_ID)
if( menu.left > menuW*-1+20+10 ) {
menu.left -= 8
in_ID = setTimeout("menuIn()", 1)
}
else if( menu.left > menuW*-1+20 ) {
menu.left--
in_ID = setTimeout("menuIn()", 1)
}
}
else {
clearTimeout(out_ID)
if( menu.pixelLeft > menuW*-1+20+10 ) {
menu.pixelLeft -= 4
in_ID = setTimeout("menuIn()", 1)
}
else if( menu.pixelLeft > menuW*-1+20 ) {
menu.pixelLeft--
in_ID = setTimeout("menuIn()", 1)
}
}
}
function menuOut() {
if(n4) {
clearTimeout(in_ID)
if( menu.left < -10) {
menu.left += 4
out_ID = setTimeout("menuOut()", 1)
}
else if( menu.left < 0) {
menu.left++
out_ID = setTimeout("menuOut()", 1)
}

}
else {
clearTimeout(in_ID)
if( menu.pixelLeft < -10) {
menu.pixelLeft += 2
out_ID = setTimeout("menuOut()", 1)
}
else if( menu.pixelLeft < 0 ) {
menu.pixelLeft++
out_ID = setTimeout("menuOut()", 1)
}
}
}
function fireOver() {
clearTimeout(F_out)
F_over = setTimeout("menuOut()", 10)
}
function fireOut() {
clearTimeout(F_over)
F_out = setTimeout("menuIn()", 10)
}
function init() {
if(n4) {
menu = document.D1
menuW = menu.document.width
menu.left = menuW*-1+20
document.D1.onmouseover = menuOut
document.D1.onmouseout = menuIn
menu.visibility = "visible"
}
else if(e4) {
menu = D1.style
menuW = D1.offsetWidth
D1.style.pixelLeft = menuW*-1+20
D1.onmouseover = fireOver
D1.onmouseout = fireOut
D1.style.visibility = "visible"
}
}
F_over=F_out=in_ID=out_ID=null
n4 = (document.layers)?1:0
e4 = (document.all)?1:0;
</s cript>

in the middle of <body>and</head>:

<div id="D1">
<table border="0">
<tr>
<td align="middle"><b style="COLOR: green">菜单</b></td>
</tr>
<tr>
<td>
<ul>
<li><a href="http://www.hongen.com";;>洪恩在线</a> </li>
<li><a href="http://www.teacher.edu.cn";;>中国园丁网</a> </li>
<li><a href="http://www.sina.com.cn";;>新浪网</a> </li>
</ul>
</td>
</tr>
</table>
</div>

放在<body>内:
<body onload="init()">

渐隐的特效
将下面的代码复制到<head>~</head>里:
<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5)">

<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5)"> // 进入时渐隐
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5)">  // 退出时渐隐

先看看效果……鼠标右键的效果!
100c.33kz.com

再来代码

先在<head></head>之间加入

<style type="text/css">
.menutable {
BORDER-RIGHT: #307ce8 1px solid; BORDER-TOP: #94bcf3 1px solid; FONT-SIZE: 12px; Z-INDEX: 100; BORDER-LEFT: #307ce8 5px solid; BORDER-BOTTOM: #307ce8 1px solid; POSITION: absolute; BACKGROUND-COLOR: #ffffff
}
.menutrin {
CURSOR: hand; COLOR: #ffffff; BACKGROUND-COLOR: #D6E4FA
}
.menutrout {
CURSOR: hand; COLOR: #000000
}
.menutd0 {
WIDTH: 28px; HEIGHT: 25px; TEXT-ALIGN: center; 改变这个修改菜单高度---:
}
.menutd1 {
WIDTH: 46px; FONT-FAMILY: Webdings; TEXT-ALIGN: right
}
.linktd1 {
WIDTH: 46px
}
.menutd2 {
WIDTH: 4px
}
.menuhr {
BORDER-RIGHT: #307ce8 1px inset; BORDER-TOP: #307ce8 1px inset; BORDER-LEFT: #307ce8 1px inset; BORDER-BOTTOM: #307ce8 1px inset
}

</style>
<BGSOUND id=theBS src="images/menu.wav" loop=0>

然后在<body></body>中间加入这些,上面一些变量很清楚,大家自己修改!

<s cript language="javas cript" type="text/javas cript">

// 以下数据有详细说明各部分请参照修改

var IconList = new Array(); // 请注意图象路径!icon图片集合可填加删除,下标从 1 开始

IconList[1] = new Image();

IconList[1].src = "images/winxp1.gif";

IconList[2] = new Image();

IconList[2].src = "images/home.gif";

IconList[3] = new Image();

IconList[3].src = "images/doc.gif";

IconList[4] = new Image();

IconList[4].src = "images/view.gif";

IconList[5] = new Image();

IconList[5].src = "images/talk.gif";

IconList[6] = new Image();

IconList[6].src = "images/into.gif";

IconList[7] = new Image();

IconList[7].src = "images/url.gif";

IconList[8] = new Image();

IconList[8].src = "images/save.gif";

IconList[9] = new Image();

IconList[9].src = "images/email.gif";

IconList[10] = new Image();

IconList[10].src = "images/friend.gif";

// 检测变量 菜单的显示隐藏就靠它了!!! //

var JustMenuID = "";

var SubMenuList = new Array();

var NowSubMenu = "";

var mouseCanSound = true; // 声音开关 声音开关 //

var menuSpeed = 80; // 菜单显示速度 //

var alphaStep = 50; // Alpaha 变化 度 //

//构建 主菜单 对象 //

function MouseMenu(objName)
{
this.id = "Menu_"+objName;
this.obj = objName;
this.length = 0;


this.addMenu = addMenu;
this.addLink = addLink;
this.addHR = addHR;

JustMenuID = this.id;

document.body.insertAdjacentHTML('beforeEnd','<table id="'+this.id+'" border="0" cellspacing="0" cellpadding="0" style="top: 0; left: 0; visibility: hidden; filter:Alpha(Opacity=0);" class="menutable" onmousedown=event.cancelBubble=true; onmouseup=event.cancelBubble=true></table>');
}

//构建 子菜单 对象 //

function SubMenu(objName,objID)
{
this.obj = objName;
this.id = objID;

this.addMenu = addMenu;
this.addLink = addLink;
this.addHR = addHR;

this.length = 0;
}


// 生成 菜单 makeMenu 方法 //
function makeMenu(subID,oldID,word,icon,url,target,thetitle)
{
var thelink = '';


if(icon&&icon!="")
{
icon = '<img border="0" src="'+IconList[icon].src+'">';
}
else
{
icon = '';
}

if(!thetitle||thetitle=="")
{
thetitle = '';
}


if(url&&url!="")
{
thelink += '<a href="'+url+'" ';

if(target&&target!="")
{
thelink += ' ';
thelink += 'target="'+target+'" '
}

thelink += '></a>';
}

var Oobj = document.getElementById(oldID);

/*--------------------------------------------- 菜单html样式

<tr class="menutrout" id="trMenu_one_0" title="I am title">
<td class="menutd0"><img src="icon/sub.gif" border="0" width="16" height="16"></td>
<td><a href="javas cript:alert('I am menu');" target="_self"></a><nobr>菜单一</nobr></td>
<td class="menutd1">4</td>
<td class="menutd2"> </td>
</tr>


--------------------------------------------------*/

Oobj.insertRow();


with(Oobj.rows(Oobj.rows.length-1))
{
id = "tr"+subID;
className = "menutrout";

title = thetitle;

}

eventObj = "tr"+subID;

eval(eventObj+'.attachEvent("onmouseover",MtrOver('+eventObj+'))');
eval(eventObj+'.attachEvent("onclick",MtrClick('+eventObj+'))');

var trObj = eval(eventObj);

for(i=0;i<4;i++)
{
trObj.insertCell();
}

with(Oobj.rows(Oobj.rows.length-1))
{
cells(0).className = "menutd0";
cells(0).innerHTML = icon;

cells(1).innerHTML = thelink+'<nobr class=indentWord>'+word+'</nobr>';
cells(1).calssName = "indentWord"

cells(2).className = "menutd1";
cells(2).innerHTML = "4";

cells(3).className = "menutd2";
cells(3).innerText = " ";

}


document.body.insertAdjacentHTML('beforeEnd','<table id="'+subID+'" border="0" cellspacing="0" cellpadding="0" style="top: 0; left: 0; visibility: hidden; filter:Alpha(Opacity=0);" class="menutable" onmousedown=event.cancelBubble=true; onmouseup=event.cancelBubble=true></table>');


}


//生成连接 makeLink 方法//
function makeLink(subID,oldID,word,icon,url,target,thetitle)
{


var thelink = '';

if(icon&&icon!="")
{
icon = '<img border="0" src="'+IconList[icon].src+'">';
}
else
{
icon = '';
}

if(!thetitle||thetitle=="")
{
thetitle = '';
}


if(url&&url!="")
{
thelink += '<a href="'+url+'" ';

if(target&&target!="")
{
thelink += ' ';
thelink += 'target="'+target+'" '
}

thelink += '></a>';
}

var Oobj = document.getElementById(oldID);


/*--------------------------------------------- 连接html样式

<tr class="menutrout" id="trMenu_one_0" title="I am title">
<td class="menutd0"><img src="icon/sub.gif" border="0" width="16" height="16"></td>
<td><a href="javas cript:alert('I am link');" target="_self"></a><nobr>连接一</nobr></td>
<td class="linktd1"></td>
<td class="menutd2"> </td>
</tr>


--------------------------------------------------*/

Oobj.insertRow();


with(Oobj.rows(Oobj.rows.length-1))
{
id = "tr"+subID;
className = "menutrout";
title = thetitle;

}

eventObj = "tr"+subID;

eval(eventObj+'.attachEvent("onmouseover",LtrOver('+eventObj+'))');
eval(eventObj+'.attachEvent("onmouseout",LtrOut('+eventObj+'))');
eval(eventObj+'.attachEvent("onclick",MtrClick('+eventObj+'))');

var trObj = eval(eventObj);

for(i=0;i<4;i++)
{
trObj.insertCell();
}

with(Oobj.rows(Oobj.rows.length-1))
{
cells(0).className = "menutd0";
cells(0).innerHTML = icon;

cells(1).innerHTML = thelink+'<nobr class=indentWord>'+word+'</nobr>';

cells(2).className = "linktd1";
cells(2).innerText = " ";

cells(3).className = "menutd2";
cells(3).innerText = " ";

}

}


// 菜单对象 addMenu 方法 //
function addMenu(word,icon,url,target,title)
{
var subID = this.id + "_" + this.length;
var subObj = this.obj+"["+this.length+"]";

var oldID = this.id;

eval(subObj+"= new SubMenu('"+subObj+"','"+subID+"')");

makeMenu(subID,oldID,word,icon,url,target,title);

this.length++;

}


// 菜单对象 addLink 方法 //
function addLink(word,icon,url,target,title)
{
var subID = this.id + "_" + this.length;
var oldID = this.id;

makeLink(subID,oldID,word,icon,url,target,title);

this.length++;
}

// 菜单对象 addHR 方法 //
function addHR()
{
var oldID = this.id;

var Oobj = document.getElementById(oldID);

Oobj.insertRow();

/*------------------------------------------

<tr>
<td colspan="4">
<hr class="menuhr" size="1" width="95%">
</td>
</tr>

--------------------------------------------*/


Oobj.rows(Oobj.rows.length-1).insertCell();

with(Oobj.rows(Oobj.rows.length-1))
{
cells(0).colSpan= 4;
cells(0).insertAdjacentHTML('beforeEnd','<hr class="menuhr" size="1" width="95%">');
}

}




// MtrOver(obj)//
function MtrOver(obj)
{
return sub_over;

function sub_over()
{

var sonid = obj.id.substring(2,obj.id.length);

var topobj = obj.parentElement.parentElement;

NowSubMenu = topobj.id;

if(obj.className=="menutrout")
{
mouseWave();
}

HideMenu(1);

SubMenuList[returnIndex(NowSubMenu)] = NowSubMenu;

ShowTheMenu(sonid,MPreturn(sonid))

SubMenuList[returnIndex(obj.id)] = sonid;

if(topobj.oldTR)
{
eval(topobj.oldTR+'.className = "menutrout"');
}

obj.className = "menutrin";

topobj.oldTR = obj.id;


}
}

//--------- LtrOver(obj)-------------------//
function LtrOver(obj)
{
return sub_over;

function sub_over()
{
var topobj = obj.parentElement.parentElement;

NowSubMenu = topobj.id;

HideMenu(1);

SubMenuList[returnIndex(NowSubMenu)] = NowSubMenu;

if(topobj.oldTR)
{
eval(topobj.oldTR+'.className = "menutrout"');
}

obj.className = "menutrin";

topobj.oldTR = obj.id;

}
}

//--------- LtrOut(obj)-------------------//
function LtrOut(obj)
{
return sub_out;

function sub_out()
{
var topobj = obj.parentElement.parentElement;

obj.className = "menutrout";

topobj.oldTR = false;
}
}

//----------MtrClick(obj)-----------------//

function MtrClick(obj)
{
return sub_click;

function sub_click()
{
if(obj.cells(1).all.tags("A").length>0)
{
obj.cells(1).all.tags("A")(0).click();
}

}
}


//---------- returnIndex(str)--------------//

function returnIndex(str)
{
return (str.split("_").length-3)
}


//---------ShowTheMenu(obj,num)-----------------//

function ShowTheMenu(obj,num)
{
var topobj = eval(obj.substring(0,obj.length-2));

var trobj = eval("tr"+obj);

var obj = eval(obj);

if(num==0)
{
with(obj.style)
{
pixelLeft = topobj.style.pixelLeft +topobj.offsetWidth;
pixelTop = topobj.style.pixelTop + trobj.offsetTop;
}
}
if(num==1)
{
with(obj.style)
{
pixelLeft = topobj.style.pixelLeft + topobj.offsetWidth;
pixelTop = topobj.style.pixelTop + trobj.offsetTop + trobj.offsetHeight - obj.offsetHeight;
}
}
if(num==2)
{
with(obj.style)
{
pixelLeft = topobj.style.pixelLeft - obj.offsetWidth;
pixelTop = topobj.style.pixelTop + trobj.offsetTop;
}
}
if(num==3)
{
with(obj.style)
{
pixelLeft = topobj.style.pixelLeft - obj.offsetWidth;
pixelTop = topobj.style.pixelTop + trobj.offsetTop + trobj.offsetHeight - obj.offsetHeight;
}
}

obj.style.visibility = "visible";

if(obj.alphaing)
{
clearInterval(obj.alphaing);
}

obj.alphaing = setInterval("menu_alpha_up("+obj.id+","+alphaStep+")",menuSpeed);
}

//----------HideMenu(num)-------------------//

/*----------------------
var SubMenuList = new Array();

var NowSubMenu = "";

---------------------*/

function HideMenu(num)
{
var thenowMenu = "";

var obj = null;

if(num==1)
{
thenowMenu = NowSubMenu
}


for(i=SubMenuList.length-1;i>=0;i--)
{
if(SubMenuList[i]&&SubMenuList[i]!=thenowMenu)
{

obj = eval(SubMenuList[i]);

if(obj.alphaing)
{
clearInterval(obj.alphaing);
}

obj.alphaing = setInterval("menu_alpha_down("+obj.id+","+alphaStep+")",menuSpeed);

obj.style.visibility = "hidden";

eval("tr"+SubMenuList[i]).className = "menutrout";

SubMenuList[i] = null;
}
else
{
if(SubMenuList[i]==thenowMenu)
{
return;
}
}
}

NowSubMenu = "";
}



//-----------MainMenuPosition return()------------//

function MMPreturn()
{
var obj = eval(JustMenuID);

var x = event.clientX;
var y = event.clientY;

var judgerX = x + obj.offsetWidth;
var judgerY = y + obj.offsetHeight;

var px = 0;
var py = 0;

if(judgerX>document.body.clientWidth)
{
px = 2;
}
if(judgerY>document.body.clientHeight)
{
py = 1;
}

return (px+py);
}

//-----------MenuPosition return(obj)--------------//

function MPreturn(obj)
{
var topobj = eval(obj.substring(0,obj.length-2));

var trobj = eval("tr"+obj);

var x = topobj.style.pixelLeft + topobj.offsetWidth;
var y = topobj.style.pixelTop + trobj.offsetTop;

obj = eval(obj);

var judgerY = obj.offsetHeight + y;
var judgerX = obj.offsetWidth + x;

var py = 0;
var px = 0;

if(judgerY>=document.body.clientHeight)
{
py = 1;
}

if(judgerX>= document.body.clientWidth)
{
px = 2;
}

return (px+py);
}

//-----------修改鼠标声音路径-------------//

function mouseWave()
{
if(mouseCanSound)
{
theBS.src= "images/menu.wav";
}
}

//----------- menu_alpha_down -------//

function menu_alpha_down(obj,num)
{
var obj = eval(obj);

if(obj.filters.Alpha.Opacity > 0 )
{
obj.filters.Alpha.Opacity += -num;
}
else
{
clearInterval(obj.alphaing);
obj.filters.Alpha.Opacity = 0;
obj.alphaing = false;
obj.style.visibility = "hidden";
}
}


//------------ menu_alpha_up --------//

function menu_alpha_up(obj,num)
{
var obj = eval(obj);

if(obj.filters.Alpha.Opacity<100)
obj.filters.Alpha.Opacity += num;
else
{
clearInterval(obj.alphaing);
obj.filters.Alpha.Opacity = 100;
obj.alphaing = false;
}
}


//----------- IE ContextMenu -----------------//

function document.oncontextmenu()
{
return false;
}


//----------- IE Mouseup ----------------//

function document.onmouseup()
{
if(event.button==2)
{

HideMenu(0);


var obj = eval(JustMenuID)


obj.style.visibility = "hidden";


if(obj.alphaing)
{
clearInterval(obj.alphaing);
}

obj.filters.Alpha.Opacity = 0;

var judger = MMPreturn()

if(judger==0)
{
with(obj.style)
{
pixelLeft = event.clientX + document.body.scrollLeft;
pixelTop = event.clientY + document.body.scrollTop;
}
}
if(judger==1)
{
with(obj.style)
{
pixelLeft = event.clientX + document.body.scrollLeft;
pixelTop = event.clientY - obj.offsetHeight + document.body.scrollTop;
}
}
if(judger==2)
{
with(obj.style)
{
pixelLeft = event.clientX - obj.offsetWidth + document.body.scrollLeft;
pixelTop = event.clientY + document.body.scrollTop;
}
}
if(judger==3)
{
with(obj.style)
{
pixelLeft = event.clientX - obj.offsetWidth + document.body.scrollLeft;
pixelTop = event.clientY - obj.offsetHeight + document.body.scrollTop;
}
}

mouseWave();

obj.style.visibility = "visible";

obj.alphaing = setInterval("menu_alpha_up("+obj.id+","+alphaStep+")",menuSpeed);


}
}

//---------- IE MouseDown --------------//

function document.onmousedown()
{
if(event.button==1)
{
HideMenu();

var obj = eval(JustMenuID)

if(obj.alphaing)
{
clearInterval(obj.alphaing);
}

obj.alphaing = setInterval("menu_alpha_down("+obj.id+","+alphaStep+")",menuSpeed);

}
}
//----->


var one = new MouseMenu("one");

one.addMenu(" 闪闪客栈栏目导航",4);
one[0].addLink("闪闪客栈首页",2,"http://www.33kz.com";;,"_blank")
one[0].addHR()
one[0].addLink("动画欣赏栏目","","http://flash.33kz.com";;,"_blank")
one[0].addLink("闪客听吧栏目","","http://music.33kz.com";;,"_blank")
one[0].addLink("教程天地栏目","","http://jc.33kz.com";;,"_blank")
one[0].addLink("软件下载栏目","","http://down.33kz.com";;,"_blank")
one.addHR();
one.addLink("业务联系","9","http://www.33kz.com/lx.htm";;,"_blank")
one.addMenu("友情链接",10);
one[2].addLink("闪客听吧","","http://music.33kz.com";;,"_blank")
one[2].addLink("精彩动画MTV","","http://flash.33kz.com";;,"_blank")
one[2].addLink("在线教程","","http://jc.33kz.com";;,"_blank")
one[2].addHR()
one[2].addMenu(" 其它介绍",6);
one[2][one[2].length-1].addLink("关于我们","","http://www.33kz.com/about.htm";;,"_blank")
one[2][one[2].length-1].addLink("广告业务","","http://www.33kz.com/gg.htm";;,"_blank")
one[2][one[2].length-1].addLink("联系热线","","http://www.33kz.com/lx.htm";;,"_blank")
one.addHR();
one.addLink("请进入论坛",5,"ttp://www.33kz.com/bbs/cgi-bin/leoboard.cgi","_blank")
one.addHR();
one.addLink("☆ 本站业务 ☆",1,"javas cript:alert('将在近期推出网站制作、企业形象设计、广告设计等业务!')")
</s cript>


动态光源效果
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0046http://liang.uhome.net/powerpanda/me/css/7.htm -->
<HTML><HEAD><TITLE>动态光源效果</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<STYLE>.shadow {
FILTER: shadow(color=blue,direction=225)
}
.shadow1 {
FILTER: shadow(color=red,direction=225)
}
.shadow2 {
FILTER: shadow(color=gray,direction=225)
}
.div {
CURSOR: move; FILTER: blur(add=ture,direction=135,strength=10); WIDTH: 800px
}
</STYLE>

<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY>
<TABLE border=3 borderColor=#008080 cellSpacing=10
style="COLOR: rgb(0,0,0); LEFT: 20px; POSITION: absolute; TOP: 20px; WIDTH: 100%">
<TBODY>

<TR>
<TD id=flttgt style="FILTER: light(enabled=1),width:300" width=449><IMG
border=0 height=300 src="004.jpg" width=400> </TD>
<TD style="VERTICAL-ALIGN: top" width=287><SPAN id=holder
stylefont-size:14ptcolor:yellow?>把鼠标移到图片上,光源会跟踪鼠标。单击图片来加入其他的等观灯光并且他们都会跟随鼠标移动。
</SPAN></TD>
</TR></TBODY></TABLE>
<s cript language=javas cript>
<!--
var g_numlights=0;
var blurbs= new Array(" 现在的动态滤镜赋予了网页更多的交互性能来响应用户的动作。"," 我们使用了光源滤镜来响应用户的点击。点击图片可以增加光源。"," 通过捕捉用户鼠标位置的方法来移动光源。"," 这里的文本改变是响应单击事件的,并且只需要少量的编程。");
window.onload=setlights;
document.onclick=keyhandler;
flttgt.onmousemove=mousehandler;

function setlights(){
flttgt.filters[0].clear();
flttgt.filters[0].addcone(0,0,5,100,100,225,225,0,60,15);
if (g_numlights>0){
flttgt.filters[0].addcone(400,170,5,100,100,225,0,0,160,15);
if (g_numlights>1){
flttgt.filters[0].addcone(320,330,5,100,100,0,225,225,60,15);

}
}


}
function keyhandler()
{
g_numlights=(g_numlights+=1)%4;
holder.innerHTML=blurbs[g_numlights];
setlights();
}


function mousehandler()
{
x=(window.event.x-80);
y=(window.event.y-80);

flttgt.filters[0].movelight(1,x,y,5,1);
if(g_numlights>0){
flttgt.filters[0].movelight(1,x,y,5,1);
if(g_numlights>1)
{
flttgt.filters[0].movelight(2,x,y,5,1);

}

}
}
</s cript>

<P><FONT color=#000000> </FONT></P>
<DIV style="POSITION: absolute; TOP: 500px">
<P> </P>
</DIV>
</BODY></HTML>
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}