Wed

04

Mar

2009

90、循环的警告框

90、循环的警告框

脚本说明:

把如下代码加入<body>区域中:

<script>

<!-- Script by Juan Valdez

function hate()

{

alert('  from ');

alert('  what');

alert('  you');

alert('  can');

alert('  see');

alert('   this');

alert('   is');

alert(' annoying');

return hate()

}

//-- done -->

</script>

<a href="javascript:hate()" onmouseover="window.status='按了可就关不掉了!';return true">

<b>最好别按</b></a>

0 Comments

Wed

04

Mar

2009

89、页面被冻结

89、页面被冻结

脚本说明:

把如下代码加入<body>区域中

<script>

function freeze(){

alert ('对不起,你死机了,哈哈!!!');while(true){window.history.back(-1)}}

</script>

<FORM>

<INPUT TYPE="BUTTON" VALUE="Freeze" onClick="freeze()">

</FORM>

 

0 Comments

Wed

04

Mar

2009

88、文字慢慢出现

88、文字慢慢出现

脚本说明:

第一步:把如下代码加入<head>区域中

<STYLE>

  .stHeadliner {font-family: lucida console, courier new, monospace;

                font-size: 11pt;

                font-weight: bold;

                font-style: italic;

                background: red;

                color: white}

 

</STYLE>

 

<SCRIPT LANGUAGE="JavaScript">

 

<!-- start hide

// Delay in milliseconds for the growing headliner

growWait=90

 

// Delay in milliseconds for the expanding headliner

expandWait=120

 

// Delay in milliseconds for the scrolling headliner

scrollWait=100

 

// Number of characters in scrolling zone for the scrolling headliner

scrollWidth=40

 

// Number of lines, specify as much as you want to use

lineMax=4

lines=new Array(lineMax)

 

// Define the lines (Text to display, url, effect, time to wait)

lines[1]=new Line("国内最好的综合性站点---网易", "http://www.7stk.net", Expand, 2000)

lines[2]=new Line("国内最好的新闻发部站点", "http://www.sina.com.cn", Scroll, 1000)

lines[3]=new Line("国内最好的搜索站点!", "http://www.7syg.com", Static, 2000)

lines[4]=new Line("给我写信吧!", "mailto:xiaoqinglu@263.net?subject=你好&cc=webmaster@javascript2000.com", Grow, 2000)

 

// Some other variables (just don't change)

lineText=""

timerID=null

timerRunning=false

spaces=""

charNo=0

charMax=0

charMiddle=0

lineNo=0

lineWait=0

 

// Define line object

function Line(text, url, type, wait) {

        this.text=text

        this.url=url

        this.Display=type

        this.wait=wait

}

 

// Fill a string with n chars c

function StringFill(c, n) {

        s=""

        while (--n >= 0) {

                s+=c

        }

        return s

}

 

function Static() {

        document.formDisplay.buttonFace.value=this.text

        timerID=setTimeout("ShowNextLine()", this.wait)

}

 

function Grow() {

        lineText=this.text

        lineWait=this.wait

        charMax=lineText.length

        TextGrow()

}

 

function TextGrow() {

        if (charNo <= charMax) {

                document.formDisplay.buttonFace.value=lineText.substring(0, charNo)

                charNo++

                timerID=setTimeout("TextGrow()", growWait)

        }

        else {

                charNo=0

                timerID=setTimeout("ShowNextLine()", lineWait)

        }

}

 

function Expand() {

        lineText=this.text

        charMax=lineText.length

        charMiddle=Math.round(charMax / 2)

        lineWait=this.wait

        TextExpand()

}

 

function TextExpand() {

        if (charNo <= charMiddle) {

                document.formDisplay.buttonFace.value=lineText.substring(charMiddle - charNo, charMiddle + charNo)

                charNo++

                timerID=setTimeout("TextExpand()", expandWait)

        }

        else {

                charNo=0

                timerID=setTimeout("ShowNextLine()", lineWait)

        }

}

 

function Scroll() {

        spaces=StringFill(" ", scrollWidth)

        lineText=spaces+this.text

        charMax=lineText.length

        lineText+=spaces

        lineWait=this.wait

        TextScroll()

}

 

function TextScroll() {

        if (charNo <= charMax) {

                document.formDisplay.buttonFace.value=lineText.substring(charNo, scrollWidth+charNo)

                charNo++

                timerID=setTimeout("TextScroll()", scrollWait)

        }

        else {

                charNo=0

                timerID=setTimeout("ShowNextLine()", lineWait)

        }

}

 

function StartHeadliner() {

        StopHeadliner()

        timerID=setTimeout("ShowNextLine()", 1000)

        timerRunning=true

}

 

function StopHeadliner() {

        if (timerRunning) {

                clearTimeout(timerID)

                timerRunning=false

        }

}

 

function ShowNextLine() {

        (lineNo < lineMax) ? lineNo++ : lineNo=1

        lines[lineNo].Display()

}

 

function GotoUrl(url)

{

        top.location.href=url

}

// end hide -->

 

</SCRIPT>

 

 

 

 

第二步:把如下代码加入<body>区域中

<form name="formDisplay">

<input class="stHeadLiner" type="button" name="buttonFace" value="** The Headliner +++ Jan Pijnacker **" onClick="GotoUrl(lines[lineNo].url)"></INPUT>

</form>

 

 

 

第三步:把如下代码加入<body>区域中

<body bgcolor="#fef4d9" onLoad="StartHeadliner()">

0 Comments

Wed

04

Mar

2009

87、按钮慢慢变色

87、按钮慢慢变色

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

hexColor = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];

function mOver() {

for (i = 0; i < 13; i++) {

setTimeout('document.myForm.button.style.background = "#'+hexColor[12-i]+'0'+hexColor[12-i]+'0c0";', i * 40);

   }

}

function mOut() {

document.myForm.button.value = "去网页特效代码";

for (i = 0; i < 12; i++) {

setTimeout('document.myForm.button.style.background = "#'+hexColor[i]+'0'+hexColor[i]+'0c0";', i * 40);

   }

}

//  End -->

</script>

<form name=myForm>

<input type=button name=button value="鼠标放过来吧!" onMouseOver='mOver()'' onMouseDown='document.myForm.button.value="   谢谢   "' onClick='window.location="http://www.7stk.com"' onMouseOut='mOut()'>

</form>

 

0 Comments

Wed

04

Mar

2009

86、动态的按钮

86、动态的按钮

脚本说明:

把如下代码加入<body>区域中

<script>

document.onmouseover = doOver;

document.onmouseout  = doOut;

document.onmousedown = doDown;

document.onmouseup   = doUp;

 

 

function doOver() {

       var toEl = getReal(window.event.toElement, "className", "coolButton");

       var fromEl = getReal(window.event.fromElement, "className", "coolButton");

       if (toEl == fromEl) return;

       var el = toEl;

      

//     alert(el);

      

//     var cDisabled = el.getAttribute("cDisabled");

       var cDisabled = el.cDisabled;

//     alert(cDisabled);

       cDisabled = (cDisabled != null); // If CDISABLED atribute is present

      

       if (el.className == "coolButton")

              el.onselectstart = new Function("return false");

      

       if ((el.className == "coolButton") && !cDisabled) {

              makeRaised(el);

              makeGray(el,false);

       }

}

 

function doOut() {

       var toEl = getReal(window.event.toElement, "className", "coolButton");

       var fromEl = getReal(window.event.fromElement, "className", "coolButton");

       if (toEl == fromEl) return;

       var el = fromEl;

 

//     var cDisabled = el.getAttribute("cDisabled");

       var cDisabled = el.cDisabled;

       cDisabled = (cDisabled != null); // If CDISABLED atribute is present

 

       var cToggle = el.cToggle;

       toggle_disabled = (cToggle != null); // If CTOGGLE atribute is present

 

       if (cToggle && el.value) {

              makePressed(el);

              makeGray(el,true);

       }

       else if ((el.className == "coolButton") && !cDisabled) {

              makeFlat(el);

              makeGray(el,true);

       }

 

}

 

function doDown() {

       el = getReal(window.event.srcElement, "className", "coolButton");

      

       var cDisabled = el.cDisabled;

       cDisabled = (cDisabled != null); // If CDISABLED atribute is present

      

       if ((el.className == "coolButton") && !cDisabled) {

              makePressed(el)

       }

}

 

function doUp() {

       el = getReal(window.event.srcElement, "className", "coolButton");

      

       var cDisabled = el.cDisabled;

       cDisabled = (cDisabled != null); // If CDISABLED atribute is present

      

       if ((el.className == "coolButton") && !cDisabled) {

              makeRaised(el);

       }

}

 

 

function getReal(el, type, value) {

       temp = el;

       while ((temp != null) && (temp.tagName != "BODY")) {

              if (eval("temp." + type) == value) {

                     el = temp;

                     return el;

              }

              temp = temp.parentElement;

       }

       return el;

}

 

function findChildren(el, type, value) {

       var children = el.children;

       var tmp = new Array();

       var j=0;

      

       for (var i=0; i<children.length; i++) {

              if (eval("children[i]." + type + "==\"" + value + "\"")) {

                     tmp[tmp.length] = children[i];

              }

              tmp = tmp.concat(findChildren(children[i], type, value));

       }

      

       return tmp;

}

 

function disable(el) {

 

       if (document.readyState != "complete") {

              window.setTimeout("disable(" + el.id + ")", 100);      // If document not finished rendered try later.

              return;

       }

      

       var cDisabled = el.cDisabled;

      

       cDisabled = (cDisabled != null); // If CDISABLED atribute is present

 

       if (!cDisabled) {

              el.cDisabled = true;

             

              el.innerHTML = '<span style="background: buttonshadow; width: 100%; height: 100%; text-align: center;">' +

                                          '<span style="filter:Mask(Color=buttonface) DropShadow(Color=buttonhighlight, OffX=1, OffY=1, Positive=0); height: 100%; width: 100%%; text-align: center;">' +

                                          el.innerHTML +

                                          '</span>' +

                                          '</span>';

 

              if (el.onclick != null) {

                     el.cDisabled_onclick = el.onclick;

                     el.onclick = null;

              }

       }

}

 

function enable(el) {

       var cDisabled = el.cDisabled;

      

       cDisabled = (cDisabled != null); // If CDISABLED atribute is present

      

       if (cDisabled) {

              el.cDisabled = null;

              el.innerHTML = el.children[0].children[0].innerHTML;

 

              if (el.cDisabled_onclick != null) {

                     el.onclick = el.cDisabled_onclick;

                     el.cDisabled_onclick = null;

              }

       }

}

 

function addToggle(el) {

       var cDisabled = el.cDisabled;

      

       cDisabled = (cDisabled != null); // If CDISABLED atribute is present

      

       var cToggle = el.cToggle;

      

       cToggle = (cToggle != null); // If CTOGGLE atribute is present

 

       if (!cToggle && !cDisabled) {

              el.cToggle = true;

             

              if (el.value == null)

                     el.value = 0;          // Start as not pressed down

             

              if (el.onclick != null)

                     el.cToggle_onclick = el.onclick;    // Backup the onclick

              else

                     el.cToggle_onclick = "";

 

              el.onclick = new Function("toggle(" + el.id +"); " + el.id + ".cToggle_onclick();");

       }

}

 

function removeToggle(el) {

       var cDisabled = el.cDisabled;

      

       cDisabled = (cDisabled != null); // If CDISABLED atribute is present

      

       var cToggle = el.cToggle;

      

       cToggle = (cToggle != null); // If CTOGGLE atribute is present

      

       if (cToggle && !cDisabled) {

              el.cToggle = null;

 

              if (el.value) {

                     toggle(el);

              }

 

              makeFlat(el);

             

              if (el.cToggle_onclick != null) {

                     el.onclick = el.cToggle_onclick;

                     el.cToggle_onclick = null;

              }

       }

}

 

function toggle(el) {

       el.value = !el.value;

      

       if (el.value)

              el.style.background = "URL(/images/tileback.gif)";

       else

              el.style.backgroundImage = "";

 

//     doOut(el);     

}

 

 

function makeFlat(el) {

       with (el.style) {

              background = "";

              border = "1px solid buttonface";

              padding      = "1px";

       }

}

 

function makeRaised(el) {

       with (el.style) {

              borderLeft   = "1px solid buttonhighlight";

              borderRight  = "1px solid buttonshadow";

              borderTop    = "1px solid buttonhighlight";

              borderBottom = "1px solid buttonshadow";

              padding      = "1px";

       }

}

 

function makePressed(el) {

       with (el.style) {

              borderLeft   = "1px solid buttonshadow";

              borderRight  = "1px solid buttonhighlight";

              borderTop    = "1px solid buttonshadow";

              borderBottom = "1px solid buttonhighlight";

              paddingTop    = "2px";

              paddingLeft   = "2px";

              paddingBottom = "0px";

              paddingRight  = "0px";

       }

}

 

function makeGray(el,b) {

       var filtval;

      

       if (b)

              filtval = "gray()";

       else

              filtval = "";

 

       var imgs = findChildren(el, "tagName", "IMG");

             

       for (var i=0; i<imgs.length; i++) {

              imgs[i].style.filter = filtval;

       }

 

}

      

 

document.write("<style>");

document.write(".coolBar     {background: buttonface;border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight;       border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; padding: 2px; font: menu;}");

document.write(".coolButton {border: 1px solid buttonface; padding: 1px; text-align: center; cursor: default;}");

document.write(".coolButton IMG       {filter: gray();}");

document.write("</style>");

</script>

<table class="coolBar">

<tr>

<td class="coolButton">

<font face="Verdana" size="3" onClick="window.location='http://www.7stk.com'"><b>网易</b></font>

</td>

<td class="coolButton">

<font face="Verdana" size="2" onClick="window.location='http://www.7stk.com'"><b>新浪网</b></font>

</td>

</tr>

</table>

<div class="coolBar" style="width:100px">

<span class="coolButton" style="width:100px" onClick="window.location='http://www.7stk.com'"><img src="home.gif"> <b>Welcome</b></span>

</div>

0 Comments

Wed

04

Mar

2009

85、按钮的背景色

85、按钮的背景色

脚本说明:

把如下代码加入<body>区域中

<script>

<!--

 

if (document.images){

after=new Image()

//change the file path below to the image you want applied when the mouse moves over

after.src="secondimage.jpg"

}

 

function change2(image){

var el=event.srcElement

if (el.tagName=="INPUT"&&el.type=="button")

event.srcElement.style.backgroundImage="url"+"('"+image+"')"

}

 

function jumpto2(url){

window.location=url

}

 

//-->

</script>

<form onMouseover="change2('backgr7.jpg')" onMouseout="change2('backgr10.jpg')">

<input type="button" value="www.sina.com.cn" class="initial" onClick="jumpto2('http://www.7stk.com')">

<br>

<input type="button" value="www.163.com" class="initial" onClick="jumpto2('http://www.7stk.com')">

</form>

0 Comments

Wed

04

Mar

2009

84、变色的按钮

84、变色的按钮

脚本说明:

把如下代码加入<body>区域中

<SCRIPT>function msover(){{event.srcElement.style.color="000099";event.srcElement.style.backgroundColor="99ccff";event.srcElement.style.cursor = "hand";}}

function msout(){{event.srcElement.style.color="red";event.srcElement.style.backgroundColor="white";event.srcElement.style.cursor = "auto";}}</SCRIPT>

<button onmouseover="msover();" onmouseout="msout();" class=button type=submit>变色按钮</button>

0 Comments

Wed

04

Mar

2009

83、文字在按钮上滚动

83、文字在按钮上滚动

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

 

<!-- Begin

var message="   Merry christmas and happy new year  ";//Put Your Message Here

function ButtonURL(){

window.location="http://www.7stk.com"

}

function scroll()

{

  message = message.substring(1,message.length) + message.substring(0,1);

  document.bs.bs.value = message;

  setTimeout("scroll()",140);

}

window.onload=scroll

document.write('<style type="text/css">')

document.write('.select{background: blue;border-color:"yellow";color:"white";font-family:Arial,Helvetica,Verdana;font-size:10pt;font-weight: bold;}')

document.write('</STYLE>')

document.write('<form name=bs><INPUT class="select" TYPE="button" NAME="bs" value="" onclick="ButtonURL()"></FORM>')

//  End -->

</script>

0 Comments

Wed

04

Mar

2009

82、源代码的显示

82、源代码的显示

脚本说明:

把如下代码加入<body>区域中

<BUTTON onclick=alert(document.documentElement.outerHTML) style="width:110">警告框显示源代码</BUTTON>

<BUTTON onclick="document.location = 'view-source:' + document.location"  style="width:80">打开源代码</BUTTON>

   

 

0 Comments

Wed

04

Mar

2009

81、按钮上的说明文字

81、按钮上的说明文字

脚本说明:

把如下代码加入<body>区域中

<DIV id=overDiv style="POSITION: absolute; Z-INDEX: 1"></DIV>

<SCRIPT language=JavaScript>

// 主背景色(大区域)

// 通常使用明快的颜色(浅黄色等...

       if (typeof fcolor == 'undefined') { var fcolor = "ffffff";}

      

// Border的颜色和标题栏的颜色;

// 通常的颜色深(褐色,黑色等。)

       if (typeof backcolor == 'undefined') { var backcolor = "#CDCDCD";}

      

      

// 文字的颜色

// 通常是比较深的颜色;

       if (typeof textcolor == 'undefined') { var textcolor = "#999900";}

      

// 标题的颜色

// 通常是明快的颜色;

       if (typeof capcolor == 'undefined') { var capcolor = "#FFFFFF";}

      

// "Close"的颜色

// 通常是明快的颜色;

       if (typeof closecolor == 'undefined') { var closecolor = "#9999FF";}

      

      

// 弹出的窗口的宽度;

// 100-300 pixels 合适

       if (typeof width == 'undefined') { var width = "130";}

      

// 边缘的宽度,象素。

// 1-3 pixels 合适

       if (typeof border == 'undefined') { var border = "1";}

      

      

// 弹出窗口位于鼠标左侧或者右侧的距离,象素。

// 3-12合适

       if (typeof offsetx == 'undefined') { var offsetx = 10;}

      

// 弹出窗口位于鼠标下方的距离;

// 3-12 合适

       if (typeof offsety == 'undefined') { var offsety = 10;}

      

////////////////////////////////////////////////////////////////////////////////////

// 设置结束

////////////////////////////////////////////////////////////////////////////////////

 

ns4 = (document.layers)? true:false

ie4 = (document.all)? true:false

 

// Microsoft Stupidity Check.

if (ie4) {

       if (navigator.userAgent.indexOf('MSIE 5')>0) {

              ie5 = true;

       } else {

              ie5 = false; }

} else {

       ie5 = false;

}

 

var x = 0;

var y = 0;

var snow = 0;

var sw = 0;

var cnt = 0;

var dir = 1;

var tr=1;

if ( (ns4) || (ie4) ) {

       if (ns4) over = document.overDiv

       if (ie4) over = overDiv.style

       document.onmousemove = mouseMove

       if (ns4) document.captureEvents(Event.MOUSEMOVE)

}

 

// 以下是页面中使用的公共函数;

 

// Simple popup right

function drs(text) {

       dts(1,text);

}

 

 

// Clears popups if appropriate

function nd() {

       if ( cnt >= 1 ) { sw = 0 };

       if ( (ns4) || (ie4) ) {

              if ( sw == 0 ) {

                     snow = 0;

                     hideObject(over);

              } else {

                     cnt++;

              }

       }

}

 

// 非公共函数,被其它的函数调用;

 

// Simple popup

function dts(d,text) {

       txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD CLASS=P1><FONT FACE=\"宋体\" COLOR=\""+textcolor+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"

       layerWrite(txt);

       dir = d;

       disp();

}

 

 

 

// Common calls

function disp() {

       if ( (ns4) || (ie4) ) {

              if (snow == 0)       {

                     if (dir == 2) { // Center

                            moveTo(over,x+offsetx-(width/2),y+offsety);

                     }

                     if (dir == 1) { // Right

                            moveTo(over,x+offsetx,y+offsety);

                     }

                     if (dir == 0) { // Left

                            moveTo(over,x-offsetx-width,y+offsety);

                     }

                     showObject(over);

                     snow = 1;

              }

       }

// Here you can make the text goto the statusbar.

}

 

// Moves the layer

function mouseMove(e) {

       if (ns4) {x=e.pageX; y=e.pageY;}

       if (ie4) {x=event.x; y=event.y;}

       if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}

       if (snow) {

              if (dir == 2) { // Center

                     moveTo(over,x+offsetx-(width/2),y+offsety);

              }

              if (dir == 1) { // Right

                     moveTo(over,x+offsetx,y+offsety);

              }

              if (dir == 0) { // Left

                     moveTo(over,x-offsetx-width,y+offsety);

              }

       }

}

 

// The Close onMouseOver function for Sticky

function cClick() {

       hideObject(over);

       sw=0;

}

 

// Writes to a layer

function layerWrite(txt) {

        if (ns4) {

                var lyr = document.overDiv.document

                lyr.write(txt)

                lyr.close()

        }

        else if (ie4) document.all["overDiv"].innerHTML = txt

              if (tr) {  }

}

 

// Make an object visible

function showObject(obj) {

        if (ns4) obj.visibility = "show"

        else if (ie4) obj.visibility = "visible"

}

 

// Hides an object

function hideObject(obj) {

        if (ns4) obj.visibility = "hide"

        else if (ie4) obj.visibility = "hidden"

}

 

// Move a layer

function moveTo(obj,xL,yL) {

        obj.left = xL

        obj.top = yL

}

 

 

</SCRIPT>

<INPUT class=hand1 onclick="window.location.href='http://www.7stk.com/'" onmouseout="nd(); return true;" onmouseover="drs('国内最大的综合*站'); return true;" size=4 type=button value="网页特效">

 

0 Comments

Wed

04

Mar

2009

80、特殊显示按钮

80、特殊显示按钮

脚本说明:

把如下代码加入<body>区域中

<STYLE type=text/css>

.button {

       BORDER-LEFT: #fcaf63 1px solid; BORDER-RIGHT: #fcaf63 1px solid; COLOR: #330000

}

.button1 {

       BORDER-LEFT: #660000 1px solid; BORDER-RIGHT: #660000 1px solid; COLOR: #ff8338

}

.buttonover {

       BACKGROUND-COLOR: #fec281; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #000000 1px solid; CURSOR: hand; 1px: #330000

}

.buttonover1 {

       BACKGROUND-COLOR: #881d00; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #000000 1px solid; COLOR: #ff8338; CURSOR: hand

}

 

.buttondown {

       BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #ffffff 1px solid; COLOR: #330000

}

 

</STYLE>

<TABLE align=center bgColor=#660000 border=0 cellPadding=0 cellSpacing=0>

  <TBODY>

  <TR align=middle>

            <TD align=middle class=button1

    onclick="location.href='http://www.7stk.com'"

    onmousedown="this.className='buttondown';"

    onmouseout="this.className='button1';"

    onmouseover="this.className='buttonover1';" width=35>南京</TD>

       <TD align=middle class=button1

    onclick="location.href='http://www.7stk.com'"

    onmousedown="this.className='buttondown';"

    onmouseout="this.className='button1';"

    onmouseover="this.className='buttonover1';" width=35>南京</TD>

    <TD align=middle class=button1

    onclick="location.href='http://www.7stk.com'"

    onmousedown="this.className='buttondown';"

    onmouseout="this.className='button1';"

    onmouseover="this.className='buttonover1';" width=35>南京</TD>

   </TR></TBODY></TABLE>

<TABLE align=center bgColor=#fcaf63 border=0 cellPadding=0 cellSpacing=0>

  <TBODY>

  <TR>

        <TD align=middle class=button

    onclick="location.href='http://www.7stk.com'"

    onmousedown="this.className='buttondown';"

    onmouseout="this.className='button';"

    onmouseover="this.className='buttonover';">淮安</TD>

    <TD align=middle class=button

    onclick="location.href='http://www.7stk.com'"

    onmousedown="this.className='buttondown';"

    onmouseout="this.className='button';"

    onmouseover="this.className='buttonover';">泰州</TD>

    <TD align=middle class=button

    onclick="location.href='http://www.7stk.com'"

    onmousedown="this.className='buttondown';"

    onmouseout="this.className='button';"

    onmouseover="this.className='buttonover';">宿迁</TD></TR></TBODY></TABLE>

0 Comments

Wed

04

Mar

2009

79、鼠标抖动的按钮

79、鼠标抖动的按钮

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

 

<!-- Begin

pos = 15;

TO = null;

function shake_funct2(object,speed)

{

  obj = eval(object)

  txt = clear_space(obj.value);

  if (pos == 15)

  {

   txt = txt + "   ";

   pos = -15;

  }

  else

  {

   txt = "   " + txt;

   pos = 15;

  } 

  obj.value = txt;

  obj.style.width = parseInt(obj.style.width) + pos;

  obj = object

  sp = speed

  TO = setTimeout("shake_funct2(obj,sp)",speed);

}

 

function clear_space(text)

{

 while (text.substring(0,1) == " ")

 {

  text = text.substring(1,text.length);

 }

 while(text.substring(text.length-1,text.length) == " ")

 {

  text = text.substring(0,text.length-1);

 }

 return text;

}

 

function end_shake_funct2(object)

{

  clearTimeout(TO);

  obj = eval(object);

  txt = clear_space(obj.value);

  obj.value = txt;

  //alert(pos);

  if (pos == -15)

  {

   obj.style.width = parseInt(obj.style.width) +15;

  }

  pos = 15

}

//  End -->

</script>

 

<form name=myform2>

<table border=0>

<tr><td>

一般抖动的按钮

</td>

<td align=center width=160>

<input type=button value = "一般速度" style="font-size:12;width:150" onmouseover="shake_funct2(this,100)" onmouseout="end_shake_funct2(this)">

</td></tr>

<tr><td>

快速抖动的按钮

</td>

<td  align=center width=160>

<input type=button value = "更快速度" style="font-size:12;width:150" onmouseover="shake_funct2(this,50)" onmouseout="end_shake_funct2(this)">

</td></tr>

</Table>

</form>

 

0 Comments

Wed

04

Mar

2009

78、Web页打开对话框

78Web页打开对话框

脚本说明:

把如下代码加入<body>区域中

<INPUT TYPE="BUTTON" NAME="Button" VALUE="单击这里看看效果" onclick="showModalDialog('http://www.huicui.jimdo.com')">

0 Comments

Wed

04

Mar

2009

77、按钮添加设置

77、按钮添加设置

脚本说明:

把如下代码加入<body>区域中

<INPUT TYPE="button" VALUE="把本站设为首页" onClick="this.style.behavior='url(#default#homepage)'; this.setHomePage('http://www.7stk.com');"><BR>

<INPUT TYPE="button" VALUE="添加到收藏夹" onClick="window.external.AddFavorite(parent.location.href, document.title);">

 

0 Comments

Wed

04

Mar

2009

76、变色的按钮

76、变色的按钮

脚本说明:

把如下代码加入<body>区域中

<style>

<!--

.initial2{font-weight:bold;background-color:lime}

//-->

</style>

 

<script>

<!--

 

function change(color){

var el=event.srcElement

if (el.tagName=="INPUT"&&el.type=="button")

event.srcElement.style.backgroundColor=color

}

 

function jumpto2(url){

window.location=url

}

 

//-->

</script>

<form onMouseover="change('yellow')" onMouseout="change('lime')">

<input type="button" value="Yahoo " class="initial2" onClick="jumpto2('http://yahoo.com')">

<input type="button" value="Sohu " class="initial2" onClick="jumpto2('http://Sohu.com')">

</form>

0 Comments

Wed

04

Mar

2009

75、立体变换的按钮

75、立体变换的按钮

脚本说明:

把如下代码加入<body>区域中

<style type="text/css">

<!--

 

.text {  font-family: "Arial", "Helvetica", "sans-serif"; font-size: 12pt; color: #ff0000 }

a:hover {  font-family: "Arial", "Helvetica", "sans-serif"; font-size: 12pt; color: #000000 ;text-decoration : none }

.normal {background-color:#ccccc; }

.over {background-color:#cccccc; border-top: 1px #ffffff solid;  border-left: 1px #ffffff solid; border-right: 1px #999999 solid; border-bottom: 1px #999999 solid }

.down {background-color:#cccccc; border-top: 1px #999999 solid;  border-left: 1px #ffffff solid; border-right: 1px #ffffff solid; border-bottom: 1px #ffffff solid }

.link {text-decoration: none; color:#000000; font-family: 宋体}

-->

</style>

<table width="80" border="0" cellpadding="0" cellspacing="0" height="30">

<tr>

<td class=normal onmouseover='this.className="over"' onmousedown='this.className="down"' onmouseup='this.className="over"' onmouseout='this.className="normal"' >

<div align="center" >

<a style="cursor: default" href="http://www.7stk.com" target="_blank">立体按钮</a>

</div>

</td>

</tr>

</table>

 

0 Comments

Wed

04

Mar

2009

74、页面内超级酷浮动窗口

74、页面内超级酷浮动窗口

脚本说明:

第一步:把如下代码加入<head>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function selectScroller(n) {

optlist = document.scrollform.scroller;

optlist[optlist.length] = new Option(optlist[0].text, "", false, false);

optlist[0] = null;

optlist.selectedIndex = -1;

n = (n + 1) % optlist.length;

// change the speed below: 1000 = 1 second.

setTimeout("selectScroller("+n+")",2000);

}

//  End -->

</script>

 

第二步:把如下代码加入<body>区域中

<form name="scrollform">

<select name="scroller" size=8>

<option>This select option list will

<option>scroll text by copying

<option>the top line to the bottom

<option>line before deleting the

<option>top line. This moves the

<option>options up one line and

<option>gives the impression of

<option>scrolling.

<option>

<option>You can leave as many

<option>blank lines as you feel

<option>necessary to give the

<option>look of begining and

<option>ending.

<option>

<option>This script was written

<option>in response to those

<option>who wanted a news

<option>scroller to work within

<option>a table's cell and for

<option>those who want old

<option>browsers to also see

<option>a scoller on the page.

<option>

<option>This select option list will

<option>scroll text by copying

<option>the top line to the bottom

<option>line before deleting the

<option>top line. This moves the

<option>options up one line and

<option>gives the impression of

<option>scrolling.

<option>

<option>You can leave as many

<option>blank lines as you feel

<option>necessary to give the

<option>look of begining and

<option>ending.

<option>

<option>This script was written

<option>in response to those

<option>who wanted a news

<option>scroller to work within

<option>a table's cell and for

<option>those who want old

<option>browsers to also see

<option>a scoller on the page.

<option>

<option>yobo42@hotmail.com

</select>

</form>

 

第三步:<body>改为

<BODY OnLoad="selectScroller(0);">

 

 

0 Comments

Wed

04

Mar

2009

73、在文本框中控制别人输入字数

73、在文本框中控制别人输入字数

脚本说明:

第一步:把如下代码加入<head>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

maxLen = 130; // max number of characters allowed

 

function checkMaxInput(form) {

if (form.message.value.length > maxLen) // if too long.... trim it!

form.message.value = form.message.value.substring(0, maxLen);

// otherwise, update 'characters left' counter

else form.remLen.value = maxLen - form.message.value.length;

}

//  End -->

</script>

 

 

第二步:把如下代码加入<body>区域中

<form name=myform action="YOUR-SCRIPT.CGI">

<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br>

<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)"></textarea>

<br>

<input readonly type=text name=remLen size=3 maxlength=3 value="130"> characters left</font>

</form>

 

 

0 Comments

Wed

04

Mar

2009

72、文本框栏目介绍

72、文本框栏目介绍

脚本说明:

第一步:把如下代码加入<head>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin        

var messages = new Array(6);

messages[0] = "";

messages[1] = "Have you ever seen anything like this before?";

messages[2] = "Can you imagine how you could use it on your site?";        

messages[3] = "It's great for sharing lots of information.";

messages[4] = "And doesn't take up much space! ";

messages[5] = "So, get the code and put it on your site!";

function messageReveal() {

var messageindex = document.messageForm.messagePick.selectedIndex

document.messageForm.messageField.value = messages[messageindex];

}

// End -->

</SCRIPT>

 

 

第二步:把如下代码加入<body>区域中

<form name="messageForm">

<select name="messagePick" OnChange="messageReveal()">

<option value="0">The Menu Message

<option>Seen this before?

<option>Possible uses?

<option>Shares Information

<option>Saves space

<option>Get the code!

</select>

<br><p>

<textarea name="messageField" rows=6 cols=50 wrap=virtual></textarea>

</form>

0 Comments

Wed

04

Mar

2009

71、鼠标响应文字变色

71、鼠标响应文字变色

脚本说明:

 

把如下代码加入<body>区域中

 

<font face="arial" size=3 onMouseOver="this.style.backgroundColor = 'red';"

 

onMouseOut="this.style.backgroundColor = 'yellow';">欢迎光临www.huicui.jimdo.com网站</font>

 

0 Comments

Wed

04

Mar

2009

70、隐藏显示字符脚本

70、隐藏显示字符脚本

脚本说明:

 

把如下代码加入<body>区域中

 

<font face="arial" size=3 onMouseOver="this.style.backgroundColor = 'red';"

 

onMouseOut="this.style.backgroundColor = 'yellow';">欢迎光临www.huicui.jimdo.com网站</font>

 

0 Comments

Wed

04

Mar

2009

69、鼠标响应图片变化

69、鼠标响应图片变化

 

脚本说明:

 

第一步:把如下代码加入<head>区域中

 

<SCRIPT language="JavaScript">

 

<!--

 

//if explorer (4.x)

 

if (document.all) {

 

              layerRef='document.all'

 

              styleRef='.style.'

 

}

 

//else if netscape (4.x)

 

else if (document.layers) {

 

              layerRef='document.layers'

 

              styleRef='.'

 

       }

 

else{

 

       alert("你使用的浏览器可能看不到效果。")

 

}

 

function show(){

 

    eval(layerRef+'["divTest"]'+styleRef+'visibility="visible"')

 

}

 

function hide(){

 

    eval(layerRef+'["divTest"]'+styleRef+'visibility="hidden"')

 

}

 

//-->

 

 

 

 

 

</SCRIPT>

 

 

 

第二步:把如下代码加入<body>区域中

 

<p align="center"><br>

 

  <a href="javascript:hide('divText.html')">隐藏字符</a> <a href="javascript:show('divText.html')">显示字符</a>

 

<p align="center">

 

<div id="divTest" style="position:absolute; left:168px; width:440px; height:32px; top:210px; visibility: hidden">

 

  <p align="center">对不起,代码不能随便看的,如果你真的想要,请与我联系!</a></p>

0 Comments

Wed

04

Mar

2009

68、页面打开特效

68、页面打开特效

脚本说明:

把如下代码加入<body>区域中:

<script language=JavaScript>

var mylocation="http://www.7stk.com"

var winheight=100

var winsize=100

var x=5

function go(){

win2=window.open("","","scrollbars")

win2.location=mylocation

if (!document.layers&&!document.all){

win2.location=mylocation

return}

win2.resizeTo(100,100)

win2.moveTo(0,0)

go2()}

function go2(){

if (winheight>=screen.availHeight-3)

x=0

win2.resizeBy(5,x)

winheight+=5

winsize+=5

if (winsize>=screen.width-5){

win2.location=mylocation

winheight=100

winsize=100

x=5

return}

setTimeout("go2()",50)

}

</script>

<a href="javascript:go()">打特殊页面</a>

0 Comments

Wed

04

Mar

2009

67、特殊的HTML字符

67、特殊的HTML字符

脚本说明:

把如下代码加入<body>区域中:

¤ ?

     

1 Comments

Wed

04

Mar

2009

66、闪烁的表格

66、闪烁的表格

脚本说明:

把如下代码加入<body>区域中:

<table border="0" width="280" id="myexample" style="border:5px solid yellow">

<tr>

<td>加入任意的物件.加入任意的物件.

<br>加入任意的物件.加入任意的物件.

<br>加入任意的物件.加入任意的物件.</td>

</tr>

</table>

<script language="JavaScript1.2">

<!--

function flashit(){

if (!document.all)

return

if (myexample.style.borderColor=="yellow")

myexample.style.borderColor="lime"

else

myexample.style.borderColor="yellow"

}

setInterval("flashit()", 500)

//-->

</script>

 

0 Comments

Wed

04

Mar

2009

65、可移动的宣传层

65、可移动的宣传层

脚本说明:

把如下代码加入区域中

<SCRIPT language=javascript>

var IE5=(document.getElementById && document.all)? true : false;

var W3C=(document.getElementById)? true: false;

var currIDb=null, currIDs=null, xoff=0, yoff=0; zctr=0; totz=0;

 

function trackmouse(evt){

if((currIDb!=null) && (currIDs!=null)){

var x=(IE5)? event.clientX+document.body.scrollLeft : evt.pageX;

var y=(IE5)? event.clientY+document.body.scrollTop : evt.pageY;

currIDb.style.left=x+xoff+'px';

currIDs.style.left=x+xoff+10+'px';

currIDb.style.top=y+yoff+'px';

currIDs.style.top=y+yoff+10+'px';

return false;

}}

 

function stopdrag(){

currIDb=null;

currIDs=null;

NS6bugfix();

}

 

function grab_id(evt){

xoff=parseInt(this.IDb.style.left)-((IE5)? event.clientX+document.body.scrollLeft : evt.pageX);

yoff=parseInt(this.IDb.style.top)-((IE5)? event.clientY+document.body.scrollTop : evt.pageY);

currIDb=this.IDb;

currIDs=this.IDs;

}

 

function NS6bugfix(){

if(!IE5){

self.resizeBy(0,1);

self.resizeBy(0,-1);

}}

 

function incrzindex(){

zctr=zctr+2;

this.subb.style.zIndex=zctr;

this.subs.style.zIndex=zctr-1;

}

 

function createPopup(id, title, width, height, x , y , isdraggable, boxcolor, barcolor, shadowcolor, text, textcolor, textptsize, textfamily ){

if(W3C){

zctr+=2;

totz=zctr;

var txt='';

txt+='<div id="'+id+'_s" style="position:absolute; left:'+(x+10)+'px; top:'+(y+10)+'px; width:'+width+'px; height:'+height+'px; background-color:'+shadowcolor+'; filter:alpha(opacity=50); visibility:visible"> </div>';

txt+='<div id="'+id+'_b" style="border:outset '+barcolor+' 2px; position:absolute; left:'+x+'px; top:'+y+'px; width:'+width+'px; overflow:hidden; height:'+height+'px; background-color:'+boxcolor+'; visibility:visible">';

txt+='<div style="width:'+width+'px; height:16px; background-color:'+barcolor+'; padding:0px; border:1px"><table cellpadding="0" cellspacing="0" border="0" width="'+(IE5? width-4 : width)+'"><tr><td width="'+(width-20)+'"><div id="'+id+'_h" style="width:'+(width-20)+'px; height:14px; font: bold 12px sans-serif; color:'+textcolor+'"> '+title+'</div></td><td align="right"><a onmousedown="document.getElementById(\''+id+'_s\').style.display=\'none\'; document.getElementById(\''+id+'_b\').style.display=\'none\';return false"><img src="closeb.gif" border="0" height="15" width="15"></a></td></tr></table></div>';

txt+='<div id="'+id+'_ov" width:'+width+'px; style="margin:2px; color:'+textcolor+'; font:'+textptsize+'pt '+textfamily+';">'+text+'</div></div>';

document.write(txt);

this.IDh=document.getElementById(id+'_h');

this.IDh.IDb=document.getElementById(id+'_b');

this.IDh.IDs=document.getElementById(id+'_s');

this.IDh.IDb.subs=this.IDh.IDs;

this.IDh.IDb.subb=this.IDh.IDb;

this.IDh.IDb.IDov=document.getElementById(id+'_ov');

if(IE5){

this.IDh.IDb.IDov.style.width=width-6;

this.IDh.IDb.IDov.style.height=height-22;

this.IDh.IDb.IDov.style.scrollbarBaseColor=boxcolor;

this.IDh.IDb.IDov.style.overflow="auto";

}else{

this.IDh.IDs.style.MozOpacity=.5;

}

this.IDh.IDb.onmousedown=incrzindex;

if(isdraggable){

this.IDh.onmousedown=grab_id;

this.IDh.onmouseup=stopdrag;

}}}

 

if(W3C)document.onmousemove=trackmouse;

if(!IE5 && W3C)window.onload=NS6bugfix;

</SCRIPT>

<SCRIPT language=javascript>

createPopup( '窗口一', '窗口一' ,  300, 120, 475, 110, true, '#D7FFD7' , 'black' , 'black' ,  '<font color="#000000">欢迎光临网页特效代码,有什么意见和建议请尽管提出来,你的意见就是对我们的促进,我们会尽量为你们服务的.<br>www.7stk.com</font>' , 'white' , 12 , 'sans-serif');

createPopup( '窗口二', '窗口二' ,  220, 130, 20, 235, true, 'darkgray' , 'navy' , 'black' ,  '欢迎光临网络编程站,有什么意见和建议请尽管提出来,你的意见就是对我们的促进,我们会尽量为你们服务的.请多多支持我们的工作,成长中的每一步都会有你的足迹!!!' , 'white' , 12 , 'arial');

</SCRIPT>

0 Comments

Wed

04

Mar

2009

64、可以移动的块

64、可以移动的块

脚本说明:

把如下代码加入<body>区域中

<SCRIPT type=text/javascript>

var dragobject = null;

var tx;

var ty;

 

function getReal(el) {

       temp = el;

 

       while ((temp != null) && (temp.tagName != "BODY")) {

              if ((temp.className == "moveme") || (temp.className == "handle")){

                     el = temp;

                     return el;

              }

              temp = temp.parentElement;

       }

       return el;

}

 

 

function moveme_onmousedown() {

       el = getReal(window.event.srcElement)

       if (el.className == "moveme") {

              dragobject = el;

              ty = (window.event.clientY - dragobject.style.pixelTop);

              tx = (window.event.clientX - dragobject.style.pixelLeft);

              window.event.returnValue = false;

              window.event.cancelBubble = true;

       }

       else if (el.className == "handle") {

              tmp = el.getAttribute("for");

              if (tmp != null) {

                     el = eval(tmp);

                     dragobject = el;

                     ty = (window.event.clientY - dragobject.style.pixelTop);

                     tx = (window.event.clientX - dragobject.style.pixelLeft);

                     window.event.returnValue = false;

                     window.event.cancelBubble = true;

              }

              else {

                     dragobject = null;

              }

       }

       else {

              dragobject = null;

       }

}

 

function moveme_onmouseup() {

       if(dragobject) {

              dragobject = null;

       }

}

 

function moveme_onmousemove() {

       if (dragobject) {

              if(window.event.clientX >= 0) {

                     dragobject.style.left = window.event.clientX - tx;

                     dragobject.style.top = window.event.clientY - ty;

              }

              window.event.returnValue = false;

              window.event.cancelBubble = true;

       }

}

 

if (document.all) { //This only works in IE4 or better

       document.onmousedown = moveme_onmousedown;

       document.onmouseup = moveme_onmouseup;

       document.onmousemove = moveme_onmousemove;

}

 

document.write("<style>");

document.write(".moveme           {cursor: move;}");

document.write(".handle              {cursor: move;}");

document.write("</style>");

</SCRIPT>

<STYLE type=text/css>#testDiv {

       BACKGROUND: window; BORDER-BOTTOM: white 2px outset; BORDER-LEFT: white 2px outset; BORDER-RIGHT: white 2px outset; BORDER-TOP: white 2px outset; HEIGHT: 100px; MARGIN: 5px; POSITION: relative; WIDTH: 400px

}

#title {

       BACKGROUND: activecaption; COLOR: captiontext; FONT: caption; MARGIN: 0px; PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 3px

}

#inner {

       BORDER-BOTTOM: white 2px inset; BORDER-LEFT: white 2px inset; BORDER-RIGHT: white 2px inset; BORDER-TOP: white 2px inset; HEIGHT: 100%; MARGIN: 0px

}

#testDiv2 {

       BACKGROUND: buttonface; BORDER-BOTTOM: white 2px outset; BORDER-LEFT: white 2px outset; BORDER-RIGHT: white 2px outset; BORDER-TOP: white 2px outset; HEIGHT: 60px; LEFT: 340px; MARGIN: 5px; PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 3px; POSITION: absolute; TOP: 360px; WIDTH: 400px

}

</STYLE>

<DIV class=moveme id=testDiv2>

<P>This is a <DIV> that you can grab anywhere<BR>This div has the

<CODE>class="moveme"</CODE></P></DIV>

 

0 Comments

Wed

04

Mar

2009

63、可移动的层

63、可移动的层

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript1.2">

 

var dragswitch=0

var nsx

var nsy

var nstemp

 

function drag_dropns(name){

temp=eval(name)

temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)

temp.onmousedown=gons

temp.onmousemove=dragns

temp.onmouseup=stopns

}

 

function gons(e){

temp.captureEvents(Event.MOUSEMOVE)

nsx=e.x

nsy=e.y

}

function dragns(e){

if (dragswitch==1){

temp.moveBy(e.x-nsx,e.y-nsy)

return false

}

}

 

function stopns(){

temp.releaseEvents(Event.MOUSEMOVE)

}

 

 

//drag drop function for IE 4+////

/////////////////////////////////

 

var dragapproved=false

 

function drag_dropie(){

if (dragapproved==true){

document.all.showimage.style.pixelLeft=tempx+event.clientX-iex

document.all.showimage.style.pixelTop=tempy+event.clientY-iey

return false

}

}

 

function initializedragie(){

iex=event.clientX

iey=event.clientY

tempx=showimage.style.pixelLeft

tempy=showimage.style.pixelTop

dragapproved=true

document.onmousemove=drag_dropie

}

 

 

if (document.all){

document.onmouseup=new Function("dragapproved=false")

}

 

////drag drop functions end here//////

 

function hidebox(){

if (document.all)

showimage.style.visibility="hidden"

else if (document.layers)

document.showimage.visibility="hide"

}

 

 

</script>

<div id="showimage" style="position:absolute;width:250px;left:250;top:250">

<table border="0" width="250" bgcolor="#000080" cellspacing="0" cellpadding="2">

  <tr>

    <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"

    height="36">

      <tr>

        <td onMousedown="initializedragie()" style="cursor:hand" width="100%"><ilayer width="100%" onSelectStart="return false"><layer width="100%" onMouseover="dragswitch=1;drag_dropns(showimage)" onMouseout="dragswitch=0"><font face="Verdana"

        color="#FFFFFF"><strong><small>移动的层</small></strong></font></layer></ilayer></td>

        <td style="cursor:hand"><a href="#" onClick="hidebox();return false"><img src="close11.gif" width="16"

        height="14" border=0></a></td>

      </tr>

      <tr>

        <td width="100%" bgcolor="#FFFFFF" style="padding:4px" colspan="2">

<small><strong><font face="Verdana">欢迎光临- <a

href="http://www.7stk.com">网页特效代码</a></font></strong></small><br>

<small><font face="Verdana">这里有超过1000种的你想要的各种代码,你一定会喜欢的!</font></small>

</td>  </tr>

    </table>

    </td>

  </tr>

</table>

</div>

0 Comments

Wed

04

Mar

2009

62、会自动消失的层

62、会自动消失的层

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript1.2">

adTime=10; // seconds ad reminder is shown

chanceAd=1; // ad will be shown 1 in X times (put 1 for everytime)

 

var ns=(document.layers);

var ie=(document.all);

var w3=(document.getElementById && !ie);

adCount=0;

function initAd(){

if(!ns && !ie && !w3) return;

if(ie) adDiv=eval('document.all.sponsorAdDiv.style');

else if(ns) adDiv=eval('document.layers["sponsorAdDiv"]');

else if(w3) adDiv=eval('document.getElementById("sponsorAdDiv").style');

randAd=Math.ceil(Math.random()*chanceAd);

if (ie||w3)

adDiv.visibility="visible";

else

adDiv.visibility ="show";

if(randAd==1) showAd();

}

function showAd(){

if(adCount<adTime*10){adCount+=1;

if (ie){documentWidth =document.body.offsetWidth/2+document.body.scrollLeft-20;

documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;}

else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;

documentHeight=window.innerHeight/2+window.pageYOffset-20;}

else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;

documentHeight=self.innerHeight/2+window.pageYOffset-20;}

adDiv.left=documentWidth-200;adDiv.top =documentHeight-200;

setTimeout("showAd()",100);}else closeAd();

}

function closeAd(){

if (ie||w3)

adDiv.display="none";

else

adDiv.visibility ="hide";

}

onload=initAd;

//End-->

</script>

<div id="sponsorAdDiv" style="visibility:hidden">

<table bgcolor="#008000"><tr><td>

<table width="300" bgcolor="#F0FFF0"><tr><td align="center" valign="middle">

<p><b>网络编程站欢迎你的光临<br>

请多提宝贵意见,谢谢<br>

你的光临是对我们最大的支持.</b>

</p>

<p>(这个显示区将在几秒钟内自动关闭)

<br>

</td></tr></table></td></tr></table>

</div>

0 Comments

Wed

04

Mar

2009

61、隐藏层的打开关闭

61、隐藏层的打开关闭

脚本说明:

把如下代码加入<body>区域中:

<script language=javascript>

ie4=(document.all)?true:false;

ns4=(document.layers)?true:false;

 

function toExit(){

var args=toExit.arguments;

var visible=args[0];

if(ns4){

              theObj=eval("document.layers[\'"+args[1]+"\']");

              if(theObj)theObj.visibility=visible;

              }

else if(ie4){

              if(visible=='show')visible='visible';

              if(visible=='hide')visible='hidden';

              theObj=eval("document.all[\'"+args[1]+"\']");

              if(theObj)theObj.style.visibility=visible;

              }

 

}    

 

</script>

<div id=boysoft

style="HEIGHT: 80px; LEFT: 309px; POSITION: absolute; TOP: 150px; VISIBILITY: hidden; WIDTH: 180px; Z-INDEX: 1">

<table bgcolor=#356f66 border=1 cellpadding=0 cellspacing=0 height=80

  width=180>

  <tbody>

                      <tr>

                        <td height=65 width="100%">

                          <table border=0 cellpadding=0 cellspacing=0 height=80 width="99%">

                            <tbody>

                            <tr>

                              <td height=57> <font

            color=#ffffff>你看,这是一个隐藏的层,不过现在你可以看到了。<b></b></font></td>

                            </tr>

                            <tr align="center">

                              <td height=23 width="100%"><a

            href="javascript:toExit('hide','boysoft')"><font color=white>关闭此窗口</font></a></td>

                            </tr>

                            </tbody>

                          </table>

                        </td>

                      </tr>

                      </tbody>

                    </table>

                  </div>

<a href="javascript:toExit('show','boysoft')"><font color="#0000FF">打开隐藏层</font></a>

 

0 Comments