当前位置:编程学习 > html/css >>

网页设计常用代码荟萃[经典]

答案:

 
('window.html','','width=394,height=290')弹出窗口

禁止页面正文选取
<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="http://old.zzzyk.com/article/Article/mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">

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

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

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

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

显示日期
<script language="javascript"><!--
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>");
// -->
</script>

设为首页
<A href=>

添加收藏
<A href=>

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

随机图片:
把如下代码加入<body>区域中
<script language="javascript"><!--
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='http://old.zzzyk.com/article/Article/photo/back.jpg'>");
if(myNum == 2) document.write("<img src='http://old.zzzyk.com/article/Article/photo/j2.gif'>"); //图片路径,可用http:// ;
if(myNum == 3) document.write("<img src='http://old.zzzyk.com/article/Article/photo/email.gif'>");
if(myNum == 4) document.write("<img src='http://old.zzzyk.com/article/Article/photo/arrow.gif'>");
if(myNum == 5) document.write("<img src='http://old.zzzyk.com/article/Article/photo/j2.gif'>");
if(myNum == 6) document.write("<img src='http://old.zzzyk.com/article/Article/photo/email.gif'>");
if(myNum == 7) document.write("<img src='http://old.zzzyk.com/article/Article/photo/arrow.gif'>");
if(myNum == 8) document.write("<img src='http://old.zzzyk.com/article/Article/photo/j2.gif'>");
if(myNum == 9) document.write("<img src='http://old.zzzyk.com/article/Article/photo/back.jpg'>");
if(myNum == 10) document.write("<img src='http://old.zzzyk.com/article/Article/photo/email.gif'>");
else {
document.write();
}
};
document.write("</CENTER>");
//-->
</script>
其实改一改随机什么都行,也不一定在body中

图片显隐效果
脚本说明:
把如下代码加入<body>区域中
<script language=javascript>
// 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);
}
}
</script>
<a href=>

 

上一个:手把手教你从主页登录论坛的代码的制作!
下一个:网站素材网站大全--特别推荐

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,