首页 优化推广 制作网页的经典script代码

制作网页的经典script代码

来源: | 时间:2010/11/8 14:29:11 |

1,获取当前网页地址
Response.Write "<script language=javascript>document.write(window.location.href);</script>"
url=Request.CurrentExecutionFilePath.ToString()

1、返回上一页
<a href="/javascript:history.go"(-1)>返回上一页</a>

1、自动清空
<input name="homepage" size="30" maxlength="100" class="editbox1" value="http://"  onMouseOver="this.focus()" onMouseOut="if(this.value="/=‘‘)this.value="‘http://‘;" onFocus="this.select()" onClick="if(this.value="/=‘http://‘)this.value="‘‘" onblur="if(this.value="/=‘‘)this.value="‘站内搜索‘">

1.‘将发言进行编码,使其不支持 HTML 语法
says = Server.HTMLEncode(says)

1.双击页面后自动滚屏,单击后停止。
<SCRIPT language=JavaScript> 
var currentpos,timer; 
function initialize() 
{ timer=setInterval("scrollwindow()",16); } 
function sc(){ 
clearInterval(timer); 

function scrollwindow() 
{currentpos=document.body.scrollTop; 
window.scroll(0,++currentpos); 
if (currentpos != document.body.scrollTop) 
sc(); 

document.onmousedown=sc 
document.ondblclick=initialize
</script>

1.<script language=JavaScript>  
document.write("最后更新时间: " + document.lastModified + "")  
</script> 

1.节日倒计时
<Script Language="JavaScript"> 
  var timedate= new Date("October 1,2002"); 
  var times="国庆节"; 
  var now = new Date(); 
  var date = timedate.getTime() - now.getTime(); 
  var time = Math.floor(date / (1000 * 60 * 60 * 24)); 
  if (time >= 0) 
  document.write("现在离"+times+"还有: "+time +"天")
</Script> 

1.显示系统当前日期
<script language=JavaScript> 
  today=new Date(); 
  function date(){ 
  this.length=date.arguments.length 
  for(var i=0;i<this.length;i++) 
  this[i+1]=date.arguments } 
  var d=new date("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); 
  document.write( 
  "<font color=##000000 style=‘font-size:9pt;font-family: 宋体‘> ", 
  today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日", 
  d[today.getDay()+1],"</font>" ); 
</script> 

 


1.不同时间段显示不同问候语 <Script Language="JavaScript"> 
var text=""; day = new Date( ); time = day.getHours( ); 
  if (( time>=0) && (time < 7 )) 
    text="夜猫子,要注意身体哦! " 
  if (( time >= 7 ) && (time < 12)) 
    text="今天的阳光真灿烂啊,你那个朋友呢?" 
  if (( time >= 12) && (time < 14)) 
    text="午休时间。您要保持睡眠哦!" 
  if (( time >=14) && (time < 18)) 
    text="祝您下午工作愉快! " 
  if ((time >= 18) && (time <= 22)) 
    text="您又来了,可别和MM聊太久哦!" 
  if ((time >= 22) && (time < 24)) 
    text="您应该休息了!" 
  document.write(text) 
</Script> 

1.锁定状态栏文字防止显示地址
<body onmouseover="self.status=‘文字‘;return true">

1.隐藏状态栏中的链接地址:
<script language="javascript">
kstatus();
function kstatus(){
self.status="GBlog () ";
setTimeout("kstatus()",0);
}
</script>

1.自动全选
<input type=text name=text1 value="123" onfocus="this.select()">

54、确认后提交
把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript">
<!--
function msg(){
if (confirm("你确认要提交嘛!"))
document.lnman.submit()
}
//-->
</SCRIPT>
<form name="lnman" method="post" action="">
  <p>
    <input type="text" name="textfield" value="确认后提交">
  </p>
  <p>
    <input type="button" name="Submit" value="提交" onclick="msg();">
  </p>
</form>


45、显示个人客户端机器的日期和时间
<script language="LiveScript">
<!-- Hiding
  today = new Date()
  document.write("现 在 时 间 是: ",today.getHours(),":",today.getMinutes())
  document.write("<br>今 天 日 期 为: ", today.getMonth()+1,"/",today.getDate(),"/",today.getYear());
// end hiding contents -->
</script>

39.在规定时间内跳转
<META http-equiv=V="REFRESH" content="5;URL=http://www.51js.com">

38.页面进入和退出的特效
进入页面<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">
推出页面<meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)"> 
这个是页面被载入和调出时的一些特效。duration表示特效的持续时间,以秒为单位。transition表示使用哪种特效,取值为1-23:
  0 矩形缩小
  1 矩形扩大
  2 圆形缩小
  3 圆形扩大
  4 下到上刷新
  5 上到下刷新
  6 左到右刷新
  7 右到左刷新
  8 竖百叶窗
  9 横百叶窗
  10 错位横百叶窗
  11 错位竖百叶窗
  12 点扩散
  13 左右到中间刷新
  14 中间到左右刷新
  15 中间到上下
  16 上下到中间
  17 右下到左上
  18 右上到左下
  19 左上到右下
  20 左下到右上
  21 横条
  22 竖条
  23 以上22种随机选择一种


23.怎样去掉图片链接点击后,图片周围的虚线?
<a href="#" onFocus="this.blur()"><img src="/logo.jpg" border=0></a>


21.让弹出窗口总是在最上面:
<body onblur="this.focus();">

22.不要滚动条?
让竖条没有:
<body style="overflow:scroll;overflow-y:hidden">
</body>
让横条没有:
<body style=&quo

服务热线

153 8323 9821

功能和特性

价格和优惠

网站和维护

推广和优化

微信服务号