当前位置:首页 > 设计在线 > 网页设计 > Javascript > 几种个人网页里常用到的特效代码介绍

几种个人网页里常用到的特效代码介绍

点击次数:28 次 发布日期:2008-12-01 17:35:58 作者:源代码网
源代码网推荐
网页里加载声音:

以下是引用片段:
<BGSOUND src="http://www.wangyeba.com/Article/web02/wytx/200608/../mid/11.mid" loop=never>

  随便加在那都可以

  渐清晰图片效果(改变图片透明度):

以下是引用片段:
<SCRIPT language=JavaScript1.2>
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
function low(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=30
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}
</SCRIPT>

  上面的加在那都可以,下面的代码加到实现图片效果的地方:

以下是引用片段:
<a href="1.htm" target="_blank"><img onmouseover=high(this) 
 style="FILTER: alpha(opacity=40)" onmouseout=low(this)
 src="http://www.wangyeba.com/Article/web02/wytx/200608/010%5B1%5D.gif" width="80" height="60" border="0"></a>

  每天自动更新的日期:

以下是引用片段:
<script LANGUAGE="JavaScript">
function number(index1){
var numberstring="一二三四五六七八九十";
  if(index1 ==0) {document.write("十")}
  if(index1 < 10){
    document.write(numberstring.substring(0+(index1-1),index1))}
  else if(index1 < 20 ){
    document.write("十"+numberstring.substring(0+(index1-11),(index1-10)))}
  else if(index1 < 30 ){
    document.write("二十"+numberstring.substring(0+(index1-21),(index1-20)))}
  else{
    document.write("三十"+numberstring.substring(0+(index1-31),(index1-30)))}
  }
var today1 = new Date()
var month = today1.getMonth()+1
var date = today1.getDate()
var day = today1.getDay()

document.write("<br><strong><small><center>")
document.write("今天是:2000年")
number(month)
document.write("月")
number(date)
document.write("日</small><center>")
</script>

  隐藏滚动条效果:

以下是引用片段:
style="OVERFLOW-Y: hidden; OVERFLOW-X: hidden; OVERFLOW: scroll"

  把代码加入到<body>里面

  右键失效效果:

以下是引用片段:
oncontextmenu=self.event.returnValue=false 
onselectstart=self.event.returnValue=false 
ondragstart=self.event.returnValue=false

  加入到<body>里面

  自制滚动条:

以下是引用片段:
<SCRIPT>
function movstar(a,time){
movx=setInterval("mov("+a+")",time)
}
function movover(){
clearInterval(movx)
}
function mov(a){
scrollx=new_date.document.body.scrollLeft
scrolly=new_date.document.body.scrollTop
scrolly=scrolly+a
new_date.window.scroll(scrollx,scrolly)
}
function wback(){
if(new_date.history.length==0){window.history.back()}
else{new_date.history.back()}
}
</SCRIPT>

源代码网供稿.
网友评论 (0)
会员中心
设计在线
本站推荐
设计在线之精华