背景: #EDF0F5 #FAFBE6 #FFF2E2 #FDE6E0 #F3FFE1 #DAFAF3 #EAEAEF 默认  
阅读新闻

一段不错的代码

[日期:2005-01-17] 来源:  作者: [字体: ]

<html>
<head>

<script language="JavaScript">
var timerID = null;
var timerRunning = false;

function stopclock (){
        if(timerRunning)


                clearTimeout(timerID);
        timerRunning = false;
}

function showtime () {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()
        //var timeValue = " " + ((hours >12) ? hours -12 :hours)
        //timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        //timeValue += ((seconds < 10) ? ":0" : ":") + seconds
        //timeValue += (hours >= 12) ? " 下午" : " 上午"
        //window.status = timeValue;
        var timeValue = ((hours <10) ?  "0" : "") + hours
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds

document.all("eventtime").value=timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}
function startclock () {
        stopclock();
        showtime();
}
</script>


<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  //eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  targ.location='selObj.options[selObj.selectedIndex].value'; 
  //转向 新的网址。
  //document.write(selObj.options[selObj.selectedIndex].value); 
  document.all("weekday").value=selObj.options[selObj.selectedIndex].value;
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>

<style>
#iewrap{
position:relative;
height:30px
}

#iewrap2{
position:absolute
}

#dropmenu03{
filter:revealTrans(Duration=1.5,Transition=12)
visibility:hide
}
a { font-size: 12pt; color: #CC0000; text-decoration: none}
a:hover { color: #330000; text-decoration: none}
</style> 

</head>


<body onLoad="startclock()">

<SCRIPT language=javascript>
var enableeffect=true

//修改以下为你自己的信息
var selection=new Array()
selection[0]='<a href="#">科华科技</a></font><br>'
selection[1]='<a href="#">科华科技</a></font><br>'
selection[2]='<a href="#">科华科技</a></font><br>'
selection[3]='<a href="#">科华科技</a></font><br>'
selection[4]='<a href="#">科华科技</a></font><br>'
selection[5]='<a href="#">科华科技</a></font><br>'
selection[6]='<a href="#">科华科技</a></font><br>'
selection[7]='<a href="#">科华科技</a></font>'

if (document.layers)
document.dropmenu01.document.dropmenu02.visibility='show'

function dropit2(){
if (document.all){
dropmenu03.style.left=document.body.scrollLeft+event.clientX-event.offsetX
dropmenu03.style.top=document.body.scrollTop+event.clientY-event.offsetY+18
if (dropmenu03.style.visibility=="hidden"){
if (enableeffect)
dropmenu03.filters.revealTrans.apply()
dropmenu03.style.visibility="visible"
if (enableeffect)
dropmenu03.filters.revealTrans.play()
}
else{
hidemenu()
}
}
}

function dropit(e){
if (document.dropmenu03.visibility=="hide")
document.dropmenu03.visibility="show"
else
document.dropmenu03.visibility="hide"
document.dropmenu03.left=e.pageX-e.layerX
document.dropmenu03.top=e.pageY-e.layerY+19
return false
}

function hidemenu(){
if (enableeffect)
dropmenu03.filters.revealTrans.stop()
dropmenu03.style.visibility="hidden"
}

function hidemenu2(){
document.dropmenu03.visibility="hide"
}

if (document.layers){
document.dropmenu01.document.dropmenu02.captureEvents(Event.CLICK)
document.dropmenu01.document.dropmenu02.onclick=dropit
}
else if (document.all)
document.body.onclick=hidemenu
</SCRIPT> 


<!-- 通过下面的属性设置菜单出现的绝对位置和外观风格--> 
<script language="JavaScript1.2">
if (document.layers){
document.dropmenu03.captureEvents(Event.CLICK)
document.dropmenu03.onclick=hidemenu2
}
</script> 

<span id="iewrap">
<span id="iewrap2" onClick="dropit2();
event.cancelBubble=true;return false"
style="width: 69px; height: 16px; left: 158px; top: 51px"> 
<a href="#">选择网点</a> <br> </span></span> 
<div id="dropmenu03" style="position:absolute;left:315px;top:80px;width:89px;visibility:hidden;padding:0px; height: 17px"> 
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" size="1">   
        <option value="http://www.7118.net">- 企 霸 网 -</option> 
        <option value="http://www.sohu.com">- 搜狐网站 -</option> 
        <option value="http://www.sina.com.cn">- 新浪网站 -</option> 
        <option value="http://www.cctv.com">-中央电视台-</option> 
        <option value="http://www.7118.net">- 企 霸 网 -</option> 
</select> 
<select size="1" name="D1" onChange="MM_jumpMenu('parent',this,0)" size="1"><option value="aaaaa">aaaaa</option><option value="bbbbb">bbbbb</option><option value="ccccc">ccccc</option></select>
<select size="1" name="D2" onChange="MM_jumpMenu('parent',this,0)" size="1"><option value="aaaaa">aaaaa</option><option value="bbbbb">bbbbb</option><option value="ccccc">ccccc</option></select>
<select size="1" name="D3" onChange="MM_jumpMenu('parent',this,0)" size="1"><option value="aaaaa">aaaaa</option><option value="bbbbb">bbbbb</option><option value="ccccc">ccccc</option></select>
<select size="1" name="D4" onChange="MM_jumpMenu('parent',this,0)" size="1"><option value="aaaaa">aaaaa</option><option value="bbbbb">bbbbb</option><option value="ccccc">ccccc</option></select>
<select size="1" name="D5" onChange="MM_jumpMenu('parent',this,0)" size="1"><option value="aaaaa">aaaaa</option><option value="bbbbb">bbbbb</option><option value="ccccc">ccccc</option></select>
<select size="1" name="D6" onChange="MM_jumpMenu('parent',this,0)" size="1"><option value="aaaaa">aaaaa</option><option value="bbbbb">bbbbb</option><option value="ccccc">ccccc</option></select>
<select size="1" name="D7" onChange="MM_jumpMenu('parent',this,0)" size="1"><option value="aaaaa">aaaaa</option><option value="bbbbb">bbbbb</option><option value="ccccc">ccccc</option></select>
</div>

<br>
<form>
<input name=weekday><br><br>
<input name=eventtime>

</form>

-------------------------------------------------------------------------<br>
以下四个文本框,每个限输入四个字符,输入完后自动跳到下一文本框<br>
<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--
function T1_onkeyup() {
  if(document.card.T1.value.length==4){
     document.card.T2.focus();
   }

function T2_onkeyup() {
  if(document.card.T2.value.length==4){
     document.card.T3.focus();
   }
}

function T3_onkeyup() {
  if(document.card.T3.value.length==4){
     document.card.T4.focus();
   }
}
//-->
</script>
<form method="POST" name="card" action>
输入字符:
<input type="text" name="T1" size="4" maxlength="4" LANGUAGE="javascript" onkeyup="return T1_onkeyup()">-

<input type="text" name="T2" size="4" maxlength="4" LANGUAGE="javascript" onkeyup="return T2_onkeyup()">-

<input type="text" name="T3" size="4" maxlength="4" LANGUAGE="javascript" onkeyup="return T3_onkeyup()">-

<input type="text" name="T4" size="4" maxlength="4">
</form> 

--------------------------------------------------------------<br>

 <script type='text/javascript'>
// [dFilter] - A Numerical Input Mask for JavaScript
// Written By Dwayne Forehand - March 27th, 2003
// Please reuse & redistribute while keeping this notice.

var dFilterStep

function dFilterStrip (dFilterTemp, dFilterMask)
{
    dFilterMask = replace(dFilterMask,'#','');
    for (dFilterStep = 0; dFilterStep < dFilterMask.length++; dFilterStep++)
{
    dFilterTemp = replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),'');
}
return dFilterTemp;
}

function dFilterMax (dFilterMask)
{
  dFilterTemp = dFilterMask;
    for (dFilterStep = 0; dFilterStep < (dFilterMask.length+1); dFilterStep++)
{
  if (dFilterMask.charAt(dFilterStep)!='#')
{
        dFilterTemp = replace(dFilterTemp,dFilterMask.charAt(dFilterStep),'');
}
}
return dFilterTemp.length;
}

function dFilter (key, textbox, dFilterMask)
{
dFilterNum = dFilterStrip(textbox.value, dFilterMask);

if (key==9)
{
    return true;
}
else if (key==8&&dFilterNum.length!=0)
{
    dFilterNum = dFilterNum.substring(0,dFilterNum.length-1);
}
    else if ( ((key>47&&key<58)||(key>95&&key<106)) && dFilterNum.length<dFilterMax(dFilterMask) )
{
        dFilterNum=dFilterNum+String.fromCharCode(key);
}

var dFilterFinal='';
    for (dFilterStep = 0; dFilterStep < dFilterMask.length; dFilterStep++)
{
        if (dFilterMask.charAt(dFilterStep)=='#')
{
  if (dFilterNum.length!=0)
  {
        dFilterFinal = dFilterFinal + dFilterNum.charAt(0);
      dFilterNum = dFilterNum.substring(1,dFilterNum.length);
  }
    else
    {
        dFilterFinal = dFilterFinal + "";
    }
}
  else if (dFilterMask.charAt(dFilterStep)!='#')
{
    dFilterFinal = dFilterFinal + dFilterMask.charAt(dFilterStep); 
}
//     dFilterTemp = replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),'');
}


textbox.value = dFilterFinal;
    return false;
}

function replace(fullString,text,by) {
// Replaces text with by in string
    var strLength = fullString.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return fullString;

    var i = fullString.indexOf(text);
    if ((!i) && (text != fullString.substring(0,txtLength))) return fullString;
    if (i == -1) return fullString;

    var newstr = fullString.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(fullString.substring(i+txtLength,strLength),text,by);

    return newstr;
}

</script> 
<form name="fred" action="fred.htm" method="post">
<table>
    <tr>
    <td>输入数字:</td>
<td><input value="" type="text" onKeyDown="javascript:return dFilter (event.keyCode, this, '###-##-####');" style="font-family:verdana;font-size:10pt;width:110px;"></td>
</tr>
    <tr>
        <td>电话号码:</td>
<td><input value="" type="text" onKeyDown="javascript:return dFilter (event.keyCode, this, '(###) ###-####');" style="font-family:verdana;font-size:10pt;width:110px;"></td>
</tr>
<tr>
        <td>邮政编码:</td>
<td><input value="" type="text" onKeyDown="javascript:return dFilter (event.keyCode, this, '###-###');" style="font-family:verdana;font-size:10pt;width:110px;"></td>
</tr>
<tr>
        <td>时间:</td>
<td><input value="" type="text" onKeyDown="javascript:return dFilter (event.keyCode, this, '##:##');" style="font-family:verdana;font-size:10pt;width:110px;"></td>
</tr>
</table>
</form>


------------------------------------------------------------<br>
<a href="mailto:%7A%68%61%6E%67%71%69%40%64%61%74%6F%6E%67%2E%62%69%7A">我的邮箱</a>
<!-- zhangqi at datong dot biz -->
<br>
<a href="mailto:%64%74%69%6E%66%6F%40%31%36%33%2E%6E%65%74">163</a>
<!-- dtinfo at 163 dot net -->
<br>
--------------------------------------------------------<br>
<script> 
function oCopy(obj){ 
obj.select(); 
js=obj.createTextRange(); 
js.execCommand("Copy") 

</script> 
<input type="text" value="点击我copy!" onclick="oCopy(this)"> 

<input type="text" value="点击我select!" onclick="this.select()"> 

<br>-----------------------------------------------------------<br>

 <style type="text/css">
<!--
p,form,input,textarea {
   font-family: verdana, arial, helvetica, sans-serif;
   font-size: 12px;
}
-->
</style>
<script language="JavaScript">
<!--
function str2hex(s) {
   var a,b,d;
   var hexStr = '';
   for (var i=0; i < s.length; i++) {
      d = s.charCodeAt(i);
      a = d % 16;
      b = (d - a)/16;
      hexStr += '%' + "0123456789ABCDEF".charAt(b) + "0123456789ABCDEF".charAt(a);
   }
   return hexStr;
}
function encode() {

   var s0 = document.f1.str.value;

   var encod;

   document.f1.encoded.value = encod = str2hex(s0);

 

   s0 = s0.replace(/\@/,' at ');

   s0 = s0.replace(/\./g,' dot ');

 

   document.f1.all.value =

      '<a href="mailto:' + encod + '">yourTEXThere</a>' + '\r' +

      '<!-- ' + s0 + ' -->';

}
//-->

</script>
<form name="f1">
<p><font color="#CC0000">请输入一个正确的E-mail地址:</font><br>
<input type="text" name="str" size="60" onchange="encode()"></p>
<p><font color="#CC0000">加密后的代码为:</font><br>
<input type="text" name="encoded" size="60"></p>
<p><font color="#CC0000">完整的HTML代码</font><br>
<textarea rows="4" name="all" cols="60"></textarea></p>
</form>

</body>
--------------------------------------------------<br>

<html>
<head>
<title>变换层次内容范例</title>
<script language="JavaScript">
<!--
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

bluecount = 0
redcount = 0

function layerWrite(id,nestref,text) {
if (ns4) {
var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
lyr.open()
lyr.write(text)
lyr.close()
}
else if (ie4) document.all[id].innerHTML = text
}
//-->
</script>

<style type="text/css">
<!--
.white {color:white; font-size: 14px}
#blueDiv {position:absolute; left:125; top:110; width:200; height:100; clip:rect(0,200,100,0); background-color:#ff6600; layer-background-color:#ff6600;}
A {text-decoration: underline; color:#000000}
A:visited{text-decoration: none; color:#000000}
A:hover{text-decoration: underline; color:#ff0000}
-->
</style>
</head>

<body bgcolor="#FFFFFF" onLoad="" leftmargin="0">
<center>
<font style="font-size:13px; color:#ff0000">点击下面的文字观看效果</font>
<hr noshade color=red>
  <br>
  <center>
    <a href="javascript:layerWrite('blueDiv',null,'<br><a href=\'http://7118.net\'><Span class=\'white\'>大同导航</font></span></a>')">
  <font style="font-size:13px">现在换成新的了</font></a>
    <a href="javascript:layerWrite('blueDiv',null,'<br><span class=\'white\'>再换一次内容</span>')">
  <font style="font-size:13px">再换一次</font></a>
    <br>
  </center>

  <div ID="blueDiv" style="left: 225"> <br><span class="white">原来的内容</span></div>

</center>
</body>
</html>

阅读:
录入:admin

推荐 】 【 打印
上一篇:[注意]如何关闭常见端口(113、4899、3389、6129等端口)
下一篇:网页由中间向四周打开的代码
相关新闻      
本文评论       全部评论
发表评论


点评: 字数
姓名:

  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款