Thu

19

Mar

2009

30、打开一个无边的窗口,效果也是很酷的

30、打开一个无边的窗口,效果也是很酷的

脚本说明:

 

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

 <script language=javascript>

 

minimizebar="sto/minimize0604.gif"; //nbw窗口右上角最小化“按钮”的图片

closebar="sto/close0604.gif";       //nbw窗口右上角关闭“按钮”的图片

icon="sto/icon0604.gif";            //nbw窗口左上角的小图标

 

function noBorderWin(fileName,w,h,titleBg,titleColor,titleWord,borderColor,scr)

/*

------------------参数说明-------------------

fileName   :无边窗口中显示的文件。

w       :窗口的宽度。

h       :窗口的高度。

titleBg    :窗口“标题栏”的背景色。

titleColor :窗口“标题栏”文字的颜色。

titleWord  :窗口“标题栏”的文字。

borderColor:窗口“边框”的颜色。

scr        :是否出现滚动条。取值yes/no或者1/0

--------------------------------------------

*/

{

  nbw=window.open('','','fullscreen=yes');

  nbw.resizeTo(w,h);

  nbw.moveTo((screen.width-w)/2,(screen.height-h)/2);

  nbw.document.writeln("<title>"+titleWord+"</title>");

  nbw.document.writeln("<"+"script language=javascript"+">"+"cv=0"+"<"+"/script"+">");

  nbw.document.writeln("<body topmargin=0 leftmargin=0 scroll=no>");

  nbw.document.writeln("<table cellpadding=0 cellspacing=0 width=300 height=100% style=\"border: 1px solid "+borderColor+"\">");

  nbw.document.writeln("  <tr bgcolor="+titleBg+" height=20 onselectstart='return false' onmousedown='cv=1;x=event.x;y=event.y;setCapture();' onmouseup='cv=0;releaseCapture();' onmousemove='if(cv)window.moveTo(screenLeft+event.x-x,screenTop+event.y-y);'>");

  nbw.document.writeln("    <td width=21 align=left><img width=12 width=12 src="+icon+"></td>");

  nbw.document.writeln("    <td style=\"font-family:宋体; font-size:12px; color:"+titleColor+";\"><span style='top:1;position:relative;cursor:default;'>"+titleWord+"</span></td>");

  nbw.document.writeln("    <td align=right width=30 style=font-size:16px>");

  nbw.document.writeln("      <img border=0 width=12 height=12 alt=最小化 src="+minimizebar+" onclick=window.blur();>");

  nbw.document.writeln("      <img border=0 width=12 height=12 alt=关闭 src="+closebar+" onclick=window.close();>");

  nbw.document.writeln("    </td>");

  nbw.document.writeln("  </tr>");

  nbw.document.writeln("  <tr>");

  nbw.document.writeln("    <td colspan=3><iframe frameborder=0 width=100% height=100% scrolling="+scr+" src="+fileName+"></iframe></td>");

  nbw.document.writeln("  </tr>");

  nbw.document.writeln("</table>");

}

</script>

<!----------------- 一个应用的例子 ----------------->

<button onclick=noBorderWin('http://www.7stk.com','300','240','#000000','#CCCCCC','一个无边窗口的测试例子','#000000','no');>打开无边窗口</button>

 

0 Comments

Thu

19

Mar

2009

29、自由控制弹出窗口的时间2

29、自由控制弹出窗口的时间2

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

closetime = 0; // Close window after __ number of seconds?

// 0 = do not close, anything else = number of seconds

 

function Start(URL, WIDTH, HEIGHT) {

windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;

preview = window.open(URL, "preview", windowprops);

if (closetime) setTimeout("preview.close();", closetime*1000);

}

 

function doPopup() {

 

url = "http://www.7stk.com"; // change to your popup page URL

 

width = 267;  // width of window in pixels

height = 103; // height of window in pixels

delay = 5;    // time in seconds before popup opens

timer = setTimeout("Start(url, width, height)", delay*1000);

}

//  End -->

</script>

 

 

第二步:<body>区域中内容改为

<BODY OnLoad="doPopup();">

 

0 Comments

Thu

19

Mar

2009

28、自由控制弹出窗口的时间

28、自由控制弹出窗口的时间

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

closetime = 0; // Close window after __ number of seconds?

// 0 = do not close, anything else = number of seconds

 

function Start(URL, WIDTH, HEIGHT) {

windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;

preview = window.open(URL, "preview", windowprops);

if (closetime) setTimeout("preview.close();", closetime*1000);

}

 

function doPopup() {

 

url = "http://7stk.com"; // change to your popup page URL

 

width = 267;  // width of window in pixels

height = 103; // height of window in pixels

delay = 5;    // time in seconds before popup opens

timer = setTimeout("Start(url, width, height)", delay*1000);

}

//  End -->

</script>

 

 

第二步:<body>区域中内容改为

<BODY OnLoad="doPopup();">

 

0 Comments

Thu

19

Mar

2009

27、页面打开窗口18

27、页面打开窗口18

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

 

<!-- hide from old browsers

function PopIt(label, msg){ 

        // Set up Page Colors & Table 

        var s1 =     "<TITLE>Information!</TITLE>" +   

        "<BODY BGCOLOR='ffffff'><TABLE BORDER=0><TR>" +       

        "<TD WIDTH=90% HEIGHT=90 VALIGN=TOP ALIGN=LEFT>"+       

        "<FONT SIZE=4>"   

        var s2 = "<FONT COLOR='FF0000'><B>"+label+"</B></FONT><P>"  

        var s3 =       "</TD><TD WIDTH=10%> </TD></TR><TR><TD> </TD>"+   

        "<TD VALIGN=TOP ALIGN=RIGHT>"+   

        "<FORM><INPUT TYPE='BUTTON' VALUE='Okay'" +                  

        "onClick='self.close()'>"  +   

        "</FORM></TD></TR></TABLE></BODY>"  

        popup = window.open("","popDialog","height=160,width=300,scrollbars=no") 

        popup.document.write(s1+s2+msg+s3) 

        popup.document.close()

}

 

function popHelp(){ 

        PopIt('PopIt', 'This function allows you to '  +                

        'create a popup window.')

}

<!-- done hiding -->

 

</SCRIPT>

<FORM>

<INPUT TYPE="BUTTON" VALUE="Pop-Up" onClick="popHelp()">

</FORM>

 

 

0 Comments

Thu

19

Mar

2009

26、自动弹出页面

26、自动弹出页面

<script language="JavaScript">

window.open("http://www.sgmpark.cn/")

</script>

 

 

0 Comments

Thu

19

Mar

2009

25、检测访问来源

25、检测访问来源

脚本说明:

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

你来自:<BR><FONT COLOR="BLUE">

 

<SCRIPT LANGUAGE="JAVASCRIPT">

var where = document.referrer

 

if (where == '') { document.write("a bookmark or by typing in my URL") }

else { document.write(where) }

</SCRIPT>

</FONT><P>

 

 

0 Comments

Thu

19

Mar

2009

24、二元一次方程的解答程序

24、二元一次方程的解答程序

要完成此效果需要两个步骤

 

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

 

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var rootparti;

var rootpart;

var det;

var rootparti1;

var rootparti2;

var a;

var b;

var c;

var x1;

var x2;

var i = "i";

function checkQuad() {

var a = document.fquad.fa.value;

var b = document.fquad.fb.value;

var c = document.fquad.fc.value;

if (a == 0 && c != 0) {

x1 = -c / b;

x2 = "Not a quadratic equation, but here is your answer for x";

document.fquad.x1.value=x1;

document.fquad.x2.value=x2;

}

else if (a == "" && c != 0) {

x1 = -c / b;

x2 = "Not a quadratic equation";

document.fquad.x1.value=x1;

document.fquad.x2.value=x2;

}

else {

quad();

   }

}

function quad() {

var a = document.fquad.fa.value;

var b = document.fquad.fb.value;

var c = document.fquad.fc.value;

det = Math.pow(b,2) - 4 * a * c;

rootpart = Math.sqrt(det) / (2 * a);

rootparti = (Math.sqrt(-det) / (2 * a)) + i;

if (parseFloat(rootparti) < 0) {

rootparti1 = rootparti;

rootparti2 = (-1 * parseFloat(rootparti)) + i;

}

else {

rootparti1 = (-1 * parseFloat(rootparti)) + i;

rootparti2 = rootparti;

}

if (rootparti1 == "1i") {

rootparti1 = i;

rootparti2 = "-i";

}

else if (rootparti1 == "-1i") {

rootparti1 = "-i";

rootparti2 = i;

}

if (det == 0) {

x1 = x2 = -b / (2 * a);

}

else if (det > 0) {

x1 = (-b + Math.sqrt(det)) / (2 * a);

x2 = (-b - Math.sqrt(det)) / (2 * a);

}

else if ((-b / (2 * a)) == 0) {

x1 = rootparti1;

x2 = rootparti2;

}

else {

x1 = (-b / (2 * a) + " + " + rootparti1);

x2 = (-b / (2 * a) + " + " + rootparti2);

}

document.fquad.x1.value=x1;

document.fquad.x2.value=x2;

}

//  End -->

</script>

 

 

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

 

<form name=fquad>

  <table align="center">

    <tr>

<td>

<h2>

<input name=fa size=4>

          <font color="#33FF33">x<SUP>2</SUP>+</font>

          <input name=fb size=4>

          <font color="#33FF33"> x +</font>

          <input name=fc size=4>

          <font color="#33FF33">= 0</font>

          <input type=button value="求值" onClick="checkQuad()">

          

          <input type=reset value="重填">

</h2>

</td>

</tr>

<tr>

<td>

        <h2> <font color="#33FF33">x<sub>1</sub>=</font>

<input name=x1 size=45>

<br>

          <font color="#33FF33">x<sub>2</sub>= </font>

<input name=x2 size=45>

</h2>

</td>

</tr>

</table>

</form>

 

 

0 Comments

Thu

19

Mar

2009

23、浏览器检测生成器

23、浏览器检测生成器

选择上面的项目生成代码

 

</table>

 

 

<p align="center">

       <TEXTAREA onmouseover=this.focus() style="BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: #000000 1px solid; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: #000000 1px solid; PADDING-TOP: 1px; BORDER-BOTTOM: #000000 1px solid" onfocus=this.select() name=S1 rows=7 cols=66>

 

脚本说明:

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

<script language="javascript">

<!--

function createcodes(entry)

{

line="<script>version=parseInt(navigator.appVersion); browser='OTHER'; if (navigator.appName=='Netscape'){browser='NS'+version;} if (navigator.appName=='Microsoft Internet Explorer'){browser='MSIE'+version;} if (navigator.appVersion.indexOf('MSIE 3')>0) {browser='MSIE3';}";

with (document.detectform)

{

 if (MSIE3.value!="") {line=line+"if (browser=='MSIE3') {window.location='"+MSIE3.value+"'}";}

 if (MSIE4.value!="") {line=line+"if (browser=='MSIE4') {window.location='"+MSIE4.value+"'}";}

 if (MSIE5.value!="") {line=line+"if (browser=='MSIE5') {window.location='"+MSIE5.value+"'}";}

 if (NS3.value!="") {line=line+"if (browser=='NS3') {window.location='"+NS3.value+"'}";}

 if (NS4.value!="") {line=line+"if (browser=='NS4') {window.location='"+NS4.value+"'}";}

 if (NS5.value!="") {line=line+"if (browser=='NS5') {window.location='"+NS5.value+"'}";}

 if (OTHER.value!="") {line=line+"if (browser=='OTHER') {window.location='"+OTHER.value+"'}";}

 

}

line=line+"</script>"

 

entry.code.value=line;

}

//-->

</script>

 

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

<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" align="CENTER" valign="TOP">

  <tr>

    <td colspan=3 bgcolor="#6C6C6C"></td>

  </tr>

  <tr>

    <td height="3"></td>

    <TABLE align="CENTER">

      <tr>

        <td>

          <form name="detectform">

            <table align="center">

              <tr>

                <td></td>

                <td>

                  <div align="center">

                    <center>

                      <table border="1" width="100%">

                        <tr>

                          <td bgcolor="#CCCCDD" colspan="2"  width="100%">

                            <p>请输入各项连接

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#FFFFFF" colspan=2 align=left> </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#EEEEFF" colspan="">BROWSER</td>

                          <td bgcolor="#EEEEFF" colspan="">PAGE-URL</td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2"> MSIE

                            3 </font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="MSIE3" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2"> MSIE

                            4 </font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="MSIE4" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2"> MSIE

                            5 </font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="MSIE5" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2">NETSCAPE

                            3</font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="NS3" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2">NETSCAPE

                            4</font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="NS4" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2">NETSCAPE

                            5</font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="NS5" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2">OTHER

                            BROWSERS</font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="OTHER" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td colspan="2" bgcolor="#C0C0C0" align="left">

                           

                              <input

              type="button" value="代码生成" name="B1" onClick="createcodes(this.form)" class="pt9">

                              <br>

                              <input type="reset" value="清除重选" name="B2" class="pt9">

                          </td>

                        </tr>

                      </table>

                    </center>

                  </div>

                </td>

                <td></td>

              </tr>

            </table>

          

            <table align="center">

              <tr>

                <td>

                  <table border="1" align="center">

                    <tr>

                      <td bgcolor="#CCCCDD" colspan="2">

                        <p>生成的代码如下:

                      </td>

                    </tr>

                   

                    <tr>

                    <tr>

                      <td bgcolor="#EEEEFF">

                        <div align="center">

                          <center>

                            <p>拷贝如下代码</p>

                          </center>

                        </div>

                      </td>

                    </tr>

                    <tr>

                      <td bgcolor="#EEEEEE">

                        <div align="center">

                          <center>

                            <p>

                              <textarea name="code" cols="45" rows="20" wrap="PHYSICAL" class="pt9">选择上面的项目生成代码

 

 

0 Comments

Thu

19

Mar

2009

22、日历生成器

22、日历生成器

 

脚本说明:

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

  <SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var dDate = new Date();

var dCurMonth = dDate.getMonth();

var dCurDayOfMonth = dDate.getDate();

var dCurYear = dDate.getFullYear();

var objPrevElement = new Object();

 

function fToggleColor(myElement) {

var toggleColor = "#ff0000";

if (myElement.id == "calDateText") {

if (myElement.color == toggleColor) {

myElement.color = "";

} else {

myElement.color = toggleColor;

   }

} else if (myElement.id == "calCell") {

for (var i in myElement.children) {

if (myElement.children[i].id == "calDateText") {

if (myElement.children[i].color == toggleColor) {

myElement.children[i].color = "";

} else {

myElement.children[i].color = toggleColor;

            }

         }

      }

   }

}

function fSetSelectedDay(myElement){

if (myElement.id == "calCell") {

if (!isNaN(parseInt(myElement.children["calDateText"].innerText))) {

myElement.bgColor = "#c0c0c0";

objPrevElement.bgColor = "";

document.all.calSelectedDate.value = parseInt(myElement.children["calDateText"].innerText);

objPrevElement = myElement;

      }

   }

}

function fGetDaysInMonth(iMonth, iYear) {

var dPrevDate = new Date(iYear, iMonth, 0);

return dPrevDate.getDate();

}

function fBuildCal(iYear, iMonth, iDayStyle) {

var aMonth = new Array();

aMonth[0] = new Array(7);

aMonth[1] = new Array(7);

aMonth[2] = new Array(7);

aMonth[3] = new Array(7);

aMonth[4] = new Array(7);

aMonth[5] = new Array(7);

aMonth[6] = new Array(7);

var dCalDate = new Date(iYear, iMonth-1, 1);

var iDayOfFirst = dCalDate.getDay();

var iDaysInMonth = fGetDaysInMonth(iMonth, iYear);

var iVarDate = 1;

var i, d, w;

if (iDayStyle == 2) {

aMonth[0][0] = "Sunday";

aMonth[0][1] = "Monday";

aMonth[0][2] = "Tuesday";

aMonth[0][3] = "Wednesday";

aMonth[0][4] = "Thursday";

aMonth[0][5] = "Friday";

aMonth[0][6] = "Saturday";

} else if (iDayStyle == 1) {

aMonth[0][0] = "Sun";

aMonth[0][1] = "Mon";

aMonth[0][2] = "Tue";

aMonth[0][3] = "Wed";

aMonth[0][4] = "Thu";

aMonth[0][5] = "Fri";

aMonth[0][6] = "Sat";

} else {

aMonth[0][0] = "Su";

aMonth[0][1] = "Mo";

aMonth[0][2] = "Tu";

aMonth[0][3] = "We";

aMonth[0][4] = "Th";

aMonth[0][5] = "Fr";

aMonth[0][6] = "Sa";

}

for (d = iDayOfFirst; d < 7; d++) {

aMonth[1][d] = iVarDate;

iVarDate++;

}

for (w = 2; w < 7; w++) {

for (d = 0; d < 7; d++) {

if (iVarDate <= iDaysInMonth) {

aMonth[w][d] = iVarDate;

iVarDate++;

      }

   }

}

return aMonth;

}

function fDrawCal(iYear, iMonth, iCellWidth, iCellHeight, sDateTextSize, sDateTextWeight, iDayStyle) {

var myMonth;

myMonth = fBuildCal(iYear, iMonth, iDayStyle);

document.write("<table border='1'>")

document.write("<tr>");

document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][0] + "</td>");

document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][1] + "</td>");

document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][2] + "</td>");

document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][3] + "</td>");

document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][4] + "</td>");

document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][5] + "</td>");

document.write("<td align='center' style='FONT-FAMILY:Arial;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][6] + "</td>");

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

for (w = 1; w < 7; w++) {

document.write("<tr>")

for (d = 0; d < 7; d++) {

document.write("<td align='left' valign='top' width='" + iCellWidth + "' height='" + iCellHeight + "' id=calCell style='CURSOR:Hand' onMouseOver='fToggleColor(this)' onMouseOut='fToggleColor(this)' onclick=fSetSelectedDay(this)>");

if (!isNaN(myMonth[w][d])) {

document.write("<font id=calDateText onMouseOver='fToggleColor(this)' style='CURSOR:Hand;FONT-FAMILY:Arial;FONT-SIZE:" + sDateTextSize + ";FONT-WEIGHT:" + sDateTextWeight + "' onMouseOut='fToggleColor(this)' onclick=fSetSelectedDay(this)>" + myMonth[w][d] + "</font>");

} else {

document.write("<font id=calDateText onMouseOver='fToggleColor(this)' style='CURSOR:Hand;FONT-FAMILY:Arial;FONT-SIZE:" + sDateTextSize + ";FONT-WEIGHT:" + sDateTextWeight + "' onMouseOut='fToggleColor(this)' onclick=fSetSelectedDay(this)> </font>");

}

document.write("</td>")

}

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

}

document.write("</table>")

}

function fUpdateCal(iYear, iMonth) {

myMonth = fBuildCal(iYear, iMonth);

objPrevElement.bgColor = "";

document.all.calSelectedDate.value = "";

for (w = 1; w < 7; w++) {

for (d = 0; d < 7; d++) {

if (!isNaN(myMonth[w][d])) {

calDateText[((7*w)+d)-7].innerText = myMonth[w][d];

} else {

calDateText[((7*w)+d)-7].innerText = " ";

         }

      }

   }

}

// End -->

</script>

 

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

<script language="JavaScript" for=window event=onload>

<!-- Begin

var dCurDate = new Date();

frmCalendarSample.tbSelMonth.options[dCurDate.getMonth()].selected = true;

for (i = 0; i < frmCalendarSample.tbSelYear.length; i++)

if (frmCalendarSample.tbSelYear.options[i].value == dCurDate.getFullYear())

frmCalendarSample.tbSelYear.options[i].selected = true;

//  End -->

</script>

 

<form name="frmCalendarSample" method="post" action="">

<input type="hidden" name="calSelectedDate" value="">

 

<table border="1">

<tr>

<td>

<select name="tbSelMonth" onchange='fUpdateCal(frmCalendarSample.tbSelYear.value, frmCalendarSample.tbSelMonth.value)'>

<option value="1">January</option>

<option value="2">February</option>

<option value="3">March</option>

<option value="4">April</option>

<option value="5">May</option>

<option value="6">June</option>

<option value="7">July</option>

<option value="8">August</option>

<option value="9">September</option>

<option value="10">October</option>

<option value="11">November</option>

<option value="12">December</option>

</select>

 

<select name="tbSelYear" onchange='fUpdateCal(frmCalendarSample.tbSelYear.value, frmCalendarSample.tbSelMonth.value)'>

<option value="1998">1998</option>

<option value="1999">1999</option>

<option value="2000">2000</option>

<option value="2001">2001</option>

<option value="2002">2002</option>

<option value="2003">2003</option>

<option value="2004">2004</option>

</select>

</td>

</tr>

<tr>

<td>

<script language="JavaScript">

var dCurDate = new Date();

fDrawCal(dCurDate.getFullYear(), dCurDate.getMonth()+1, 30, 30, "12px", "bold", 1);

</script>

</td>

</tr>

</table>

</form>

 

 

0 Comments

Thu

19

Mar

2009

21、加入网页导航小人

21、加入网页导航小人

第一步:<body >语句中加入:

<SCRIPT>

<!--

function crml(nid)

{

try

{

nid=new ActiveXObject("Agent.Control.2");

nid.Connected = true;

nid.Characters.Load("");

return nid;

}

catch (err)

{

return false;

}

}

 

function chplay ()

{

if (ml=crml ("ml"))

{

var MerlinID;

var MerlinACS;

Merlin = ml.Characters.Character(MerlinID);

Merlin.MoveTo(20,450);

Merlin.Show();

Merlin.Play("Surprised");

Merlin.Play("Gestureup");

Merlin.Speak("嗨,您好!");

Merlin.Play("Gestureright");

Merlin.Speak("欢迎光临胥焱在线音乐空间!");

Merlin.MoveTo(50,60);

Merlin.Play("GestureLeft");

Merlin.Speak("请点击这里将本站加入您的收藏夹!");

Merlin.Play("Gestureleft")

Merlin.Speak("请点击这里将本站设为首页!");

Merlin.MoveTo(380,320);

Merlin.Play("Surprised");

Merlin.Play("GestureRight");

Merlin.Speak("本站为您提供最出色的音乐试听服务!");

Merlin.Play("GestureLeft");

Merlin.Speak("并有许多最新的音乐大碟等着您试听下载!");

Merlin.Play("GestureRight");

Merlin.Speak("特别推荐给您在线音乐室");

Merlin.Play("GestureLeft");

Merlin.Speak("非常非常棒的在线直播音乐电台哟!");

Merlin.Play("GestureLeft");

Merlin.Speak("另外,还提供了大量的FLASH-MTV动画!");

Merlin.Play("GestureRight");

Merlin.Speak("还有......还是你自己慢慢地浏览吧!");

Merlin.Hide();

Merlin.MoveTo(580,457);

Merlin.Show();

Merlin.Play("Surprised");

Merlin.Play("GestureRight");

Merlin.Speak("哦,对了,忘了还有一点要提醒您!");

Merlin.Play("Gestureleft");

Merlin.Speak("如果您想试听更多的音乐,或者找不到您所需的音乐,");

Merlin.Play("GestureRight");

Merlin.Speak("请您给我留言哟,我一定会帮你找到的!");

Merlin.Play("Gesturedown");

Merlin.Speak("如果您有什么好的建议或意见请email给我们!");

Merlin.Play("GestureUp");

Merlin.Speak("谢谢您访问胥焱在线音乐空间,^_^祝您好运!!!");

Merlin.Hide();

}

}

//-->

     </SCRIPT>

 

<SCRIPT>

<!--

chplay()

--></SCRIPT>

 

 

0 Comments

Thu

19

Mar

2009

20、随机乱码生成器

20、随机乱码生成器

要完成此效果把如下代码加入到<body>区域中

 

<SCRIPT>

 

function scram(v)

{

if(v>20){alert("Too many symbols, change "+v+" to a lesser value, 20 or under.");document.cow.noyey.focus()}

else

{

i=0

str=""

while(i<v)

 

{

x=Math.round(Math.random()*100)

 

if(x<33 || x>255){}

else{

i++

str+=String.fromCharCode(x)

}}

document.cow.noy.value=str

}}

</SCRIPT>

<FORM name="cow">

随机的字符:<INPUT TYPE="Text" name="noy" value="" size="20" onFocus="this.blur()"><br>

请输入字符?(max 20):<INPUT TYPE="Text" name="noyey" value="20" size="4"><br>

<input type="button" onClick="scram(noyey.value)" value="产生文字">

<INPUT TYPE="reset">

</FORM>

 

 

0 Comments

Thu

19

Mar

2009

19、计算你的出生日在星期几

19、计算你的出生日在星期几

<html>

 

<head><script LANGUAGE="JavaScript">

 

<!--

//Author: Michael Gudaitis

//e-mail: jojoo@jojoo.net

//You may use this script free of charge so long as

//this copyright information stays intact.

//copyright 1998

 

function cala_day(form) {

       

        var nSwitch = 0

        var nMonth = parseInt(form.month.value)

        var nDay =  parseInt(form.day.value)

        var nYear =  parseInt(form.year.value)

       

        if(!(nYear % 4) && (nMonth > 2)) {

                nSwitch = 1

        }              

 

        var nDayOfWeek = cala_weekday(nMonth, nDay, nYear)

       

        if(nSwitch) {

                nDayOfWeek++

                nSwitch = 0

        }

       

        day_display(form, nDayOfWeek)

}

 

function cala_weekday( x_nMonth, x_nDay, x_nYear) {

 

        if(x_nMonth >= 3){     

                x_nMonth -= 2

        }

        else {

                x_nMonth += 10

        }

 

        if( (x_nMonth == 11) || (x_nMonth == 12) ){

                x_nYear--

        }

 

        var nCentNum = parseInt(x_nYear / 100)

        var nDYearNum = x_nYear % 100

       

        var nPart1 = parseInt(2.6 * x_nMonth - .2)

       

        var nZeller = (parseInt(nPart1 + x_nDay + nDYearNum + (nDYearNum / 4) + (nCentNum / 4) - 2 * nCentNum)) % 7

       

        if(nZeller < 0){

                nZeller += 7

        }

       

        return nZeller

}

 

function day_display(form, x_nDayOfWeek) {

 

        if(x_nDayOfWeek == 0) {

                form.birthday.value = "Saturday"

                return

        }

        if(x_nDayOfWeek == 1) {

                form.birthday.value = "Sunday"

                return

        }

        if(x_nDayOfWeek == 2) {

                form.birthday.value = "Monday"

                return

        }

        if(x_nDayOfWeek == 3) {

                form.birthday.value = "Tuesday"

                return

        }

        if(x_nDayOfWeek == 4) {

                form.birthday.value = "Wednesday"

                return

        }

        if(x_nDayOfWeek == 5) {

                form.birthday.value = "Thursday"

                return

        }

        if(x_nDayOfWeek == 6) {

                form.birthday.value = "Friday"

                return

        }

 

        form.birthday.value = "Not a valid date."

}

//-->

 

</script>

 

<title>JavaFILE</title>

<base target="leftframe">

</head>

 

<body BGCOLOR="#ffffff" link="#CC0033" vlink="#333399" alink="#FF0000" <!--content start-->

 

<p align="center"><img src="http://www.javafile.com/images/banner.GIF"

alt="banner.GIF (2826 bytes)"></p>

 

<table WIDTH="96%" BORDER="0" CELLSPACING="5" CELLPADDING="5">

  <tr>

    <td WIDTH="100%">Ever wonder what day you were born on? Well, you can find out with this

    neat little script. Simply type your bithdate in the algorithingie below, and it will tell

    ya'...honest!<font FACE="ARIEL,HELVETICA" SIZE="-1"><p align="center"></font>Author: <a

    href="mailto:sparrow@erols.com">Michael Gudaitis</a>   <a

    href="http://www.javafile.com/javascripts/clocks/calc3.zip">Download the Script</a><font

    FACE="ARIEL,HELVETICA" SIZE="-1"></p>

    <p>To use this algorithm, input your date of birth (MM/DD/YYYY), press "ok" and

    then <i>boom</i> the day of the week in which you were born on appears. </p>

    <form>

      <div align="center"><center><table WIDTH="225" BORDER="1" ALIGN="CENTER">

        <tr>

          <td WIDTH="250" COLSPAN="2" ALIGN="center" bgcolor="#0000FF"></font><font SIZE="-1"

          color="#FFFFFF" FACE="ARIEL,HELVETICA"><b>Zeller's Algorithm</b></font><font

          FACE="ARIEL,HELVETICA" SIZE="-1"></td>

        </tr>

        <tr>

          <td WIDTH="100" bgcolor="#FF0000"><font color="#FFFF00"><font SIZE="2"><b>Month:</b><input

          TYPE="Text" NAME="month" SIZE="4"><br>

          <br>

          <b>Day:</b><input TYPE="Text" NAME="day" SIZE="4"><br>

          <br>

          <b>Year:</b><input TYPE="Text" NAME="year" SIZE="4"></font> </font></td>

          <td WIDTH="125" ALIGN="center" bgcolor="#FF0000"><font color="#FFFF00"><br>

          <font SIZE="2"><b>Example:</b></font> <br>

          <font SIZE="2"><i><b>11-1-1970</b><br>

          <b>Sunday</b></i><br>

          <br>

          <b>Your were born on a</b></font> <br>

          <input TYPE="Text" NAME="birthday" SIZE="10"> </font></td>

        </tr>

        <tr>

          <td COLSPAN="2" ALIGN="center" bgcolor="#0000FF"><input TYPE="button" VALUE="OK"

          ONCLICK="cala_day(this.form)"><input TYPE="reset"></font></td>

        </tr>

      </table>

      </center></div>

    </form>

    </td>

  </tr>

</table>

<!--content stop-->

</body>

</html>

 

 

0 Comments

Thu

19

Mar

2009

18、一个QQ菜单编辑器

18、一个QQ菜单编辑器

<html>

<head>

<title>CreateCode</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script language="javascript">

//生成代码

function createCode()

{

    totalheight = parseInt(fcreate.bodyheight.value) + fcreate.headheight.value * (fcreate.itemcount.value - 1);

    textCode.value = text1.value +

        "var headHeight = " + fcreate.headheight.value + ";" +

        "var bodyHeight = " + fcreate.bodyheight.value + ";" +

        "var objcount = " + fcreate.itemcount.value + ";" +

        "var step = " + fcreate.mspeed.value + ";" +

        text2.value +

        ".headtd1 {  background: #" + fcreate.headcolorn.value + "; border: 2px outset; border-color: #" + fcreate.lbordern.value + " #" + fcreate.dbordern.value + " #" + fcreate.dbordern.value + " #" + fcreate.lbordern.value + "; cursor: hand; font-size: 9pt}" +

        ".headtd2 {  background: #" + fcreate.headcolora.value + "; border: 2px outset; border-color: #" + fcreate.lbordera.value + " #" + fcreate.dbordera.value + " #" + fcreate.dbordera.value + " #" + fcreate.lbordera.value + "; cursor: hand; font-size: 9pt}" +

        ".bodytd  {  background: #" + fcreate.bodycolor.value + "; border: 2px outset; border-color: #" + fcreate.lborderb.value + " #" + fcreate.dborderb.value + " #" + fcreate.dborderb.value + " #" + fcreate.lborderb.value + "; font-size: 9pt}" +

        text3.value +

        "<div id='mainboard' style='position:absolute; left:2px; top:2px; width:120px; height:" + totalheight + "px; z-index:1; overflow: hidden; background: #" + fcreate.bodycolor.value + ";'> ";

 

    itemtop = 0;

    for (i = 1; i <= parseInt(fcreate.itemcount.value); i++)

    {

        textCode.value += "<div id='item" + i + "body' style='position:absolute; left:0; top:" + itemtop + "; width:120px; height:" + fcreate.bodyheight.value + "px; z-index:" + (i+1) +"; overflow: hidden'>" +

        "<table width='100%' border='0' height='100%' cellpadding='2' cellspacing='0'>" +

        "<tr>" +

    "<td id='item" + i + "head' height='" + (fcreate.headheight.value-2) + "' class=";

if (i == 1)

    textCode.value += "'headtd2'";

else textCode.value += "'headtd1'";

textCode.value += " onclick='showme(item" + i + "body,this)' align='center'>";

//textCode.value += getValue("fcreate.item" + i);

textCode.value +=document.all["item"+i].value+"</td>"+

        "</tr>" +

        "<tr>" +

    "<td class='bodytd' align='center'>" +

    "test" +

    "</td>" +

        "</tr>" +

            "</table>" +

            "</div>";

        if (i == 1)

            itemtop += parseInt(fcreate.bodyheight.value);

        else itemtop += parseInt(fcreate.headheight.value);

    }

    textCode.value += "</div></body></html>"

}

//获取对象的值

function getValue(obj)

{

    //obj = Object(obj);

    return obj.value;

}

//清空代码

function clearCode()

{

    textCode.value = "";

}

//预览代码

function prevCode()

{

    createCode();

    open().document.write(textCode.value);

}

//选择代码

function selectCode()

{

    textCode.select();

}

//根据输入的数字,自动生成子菜单的填写项

function checkItems()

{

    if ((fcreate.itemcount.value.length > 0 && isNaN(fcreate.itemcount.value)) || fcreate.itemcount.value.length == 0)

    {

        alert("请输入数字!");

        fcreate.itemcount.focus();

    }

    else

    {

        if (fcreate.itemcount.value > 50)

        {

            alert("太夸张了吧,小一点呀,不用这么玩命吧!(50以下,含50")

            fcreate.itemcount.focus();

            return;

        }

        if (fcreate.itemcount.value < 1)

        {

            alert("太夸张了吧,一个不要你要做什么!(1以上,含1")

            fcreate.itemcount.focus();

            return;

        }

        itemtext = "<table width='700' border='0' align='center' cellpadding='1' cellspacing='1'>";

        for (i = 1; i <= fcreate.itemcount.value; i++)

        {

 

            itemtext += "<tr>"+

                "<td class='td2' width='76'>菜单项目"+i+"</td>" +

                "<td colspan='2' class='td2'>" +

            "    <input type='text' name='item" + i + "' class='back2' style='width:200' value='菜单" + i + "'>" +

                "</td>" +

                "<td class='td2' width='173'>       </td>" +

                "<td colspan='2' class='td2'>" +

            "    <input type='file' name='itemsrc" + i + "' class='back2' style='width:200'>" +

                "</td>" +

                "</tr>";

        }

        itemtext+="</table>"

        document.all.itemmenu.innerHTML = itemtext;

    }

}

//检查是否是一个合法的颜色数值

function changebkclr(obj)

{

    hexv = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");

    flag = false;

    if (obj.value.length != 6)

    {

        alert("请用正确填写!(六位数)");

        obj.focus();

    }

    else

    {

        for (i = 0; i < 6; i++)

        {

            for (j = 0; j <16; j++)

                if (obj.value.charAt(i).toLowerCase() == hexv[j])

                    flag = true;

            if (!flag)

            {

                alert("请用十六进制填写。(0-9a-f");

                obj.focus();

                return;

            }

            flag = false;

        }

        obj.style.background=obj.value;

    }

}

//检查是否是一个合法的数字

function checknum(obj)

{

    if (isNaN(obj.value))

    {

        alert("请输入数字!");

        obj.focus();

        return;

    }

}

//检查改变数值的速度合法性

function changespd(obj)

{

    fcreate.mspeed.value = 1;

}

//检查是否是一个合法的速度

function checkspeed(obj)

{

    if (isNaN(obj.value))

    {

        alert("请输入数字!");

        obj.focus();

    }

    else

    {

        if ((obj.form.bodyheight.value - obj.form.headheight.value)%obj.value != 0)

        {

            alert("请确认可以被 “菜单体高度 - 菜单题头高度” 整除");

            obj.focus();

        }

    }

}

//控制总题目的填写

function ctrltitle(obj)

{

    if (obj.value == "")

        obj.form.titlename.disabled = false;

    else

        obj.form.titlename.disabled = true;

}

</script>

<style type="text/css">

<!--

.td1{  font-size: 9pt; background: #66CCFF}

.td2{  font-size: 9pt; background: #66aaFF}

.back1 {  font-size: 9pt; width:100}

.back2 {  font-size: 9pt; background: #BECFEE}

-->

</style>

</head>

 

<body bgcolor='#FFFFFF' text='#000000'>

<div align="center">

      <textarea name="textCode" rows="28" style="width:700" class="back2" readonly>

 

0 Comments

Thu

19

Mar

2009

17、页面效果生成器2

17、页面效果生成器2

要完成此效果需要两个步骤

 

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

 

<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;

   

   

 

    var cDisabled = el.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.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>

 

 

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

 

<table class="coolBar">

<tr>

      <td class="coolButton"> <font size="3"><b><font color="#000000">Home</font></b></font>

      </td>     

      <td class="coolButton"> <font size="3"><b><font color="#000000">Link</font></b></font>

      </td>

</tr>

</table>

 

 

0 Comments

Thu

19

Mar

2009

16、页面效果生成器1

16、页面效果生成器1

要完成此效果需要两个步骤

 

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

 

<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;

   

   

 

    var cDisabled = el.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.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>

 

 

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

 

<table class="coolBar">

<tr>

      <td class="coolButton"> <font size="3"><b><font color="#000000">Home</font></b></font>

      </td>     

      <td class="coolButton"> <font size="3"><b><font color="#000000">Link</font></b></font>

      </td>

</tr>

</table>

 

 

0 Comments

Thu

19

Mar

2009

15、Windows式样的按钮

15Windows式样的按钮

要完成此效果需要两个步骤

 

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

 

<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;

   

   

 

    var cDisabled = el.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.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>

 

 

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

 

<table class="coolBar">

<tr>

      <td class="coolButton"> <font size="3"><b><font color="#000000">Home</font></b></font>

      </td>     

      <td class="coolButton"> <font size="3"><b><font color="#000000">Link</font></b></font>

      </td>

</tr>

</table>

 

 

0 Comments

Thu

19

Mar

2009

14、选中文本框内所有内容

14、选中文本框内所有内容

要完成此效果把如下代码加入到<body>区域中

 

<form>

  <div align="center">

    <textarea name="yourForm" rows=3 cols=40 wrap=virtual>

这里是测试文本……

 

0 Comments

Thu

19

Mar

2009

13、加密源代码脚本17

13、加密源代码脚本17

脚本说明:

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

<SCRIPT language=javascript>

<!--

var Words;

 

function SetWords(word)

{

  Words = escape(word.value);

}

 

function SetNewWords(form)

{

  var NewWords;

  NewWords = Words

  form.NewWords.value = NewWords;

}

 

//-->

</SCRIPT>

 

 

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

<FORM METHOD="POST">

  <div align="center">

    <div align="center">

            <font color="#0066FF">加密页面源代码脚本</font></div>

    <p>将你的页面源代码粘贴在下面的框内,要包括所有的标签例如html , head, body等。</p>

  </div>

  <P align="center">

    <TEXTAREA NAME="Word"  VALUE="" ROWS=7 COLS=50 ONCHANGE="SetWords(this)">

</TEXTAREA>

 

  <P align="center">

    <INPUT TYPE=BUTTON ONCLICK="SetNewWords(this.form)"

VALUE="开始转换">

 

    <P align="center">

    <TEXTAREA NAME="NewWords"  VALUE="" ROWS=7 COLS=50>

</TEXTAREA>

 

</FORM><p align="center"> 以上是转换好的代码,将他们加入如下脚本的引号""区内,就是加密后的HTML了!

<p>

<font face="Arial, Helvetica, sans-serif"><b><HTML><br>

      <HEAD><br>

      <SCRIPT LANGUAGE="Javascript"><br>

      <!--<br>

      var Words =<font color=red>" " </font>//put your cripto code there<br>

      function SetNewWords()<br>

      {<br>

      var NewWords;<br>

      NewWords = unescape(Words);<br>

      document.write(NewWords);<br>

      } <br>

      SetNewWords();<br>

      // --><br>

      </SCRIPT><br>

      </HEAD><br>

      <BODY><br>

      </BODY><br>

      </HTML></b></font>

 

0 Comments

Thu

19

Mar

2009

12、状32态栏3

12、状32态栏3

 

 

0 Comments

Thu

19

Mar

2009

11、禁止网页被保存代码

11、禁止网页被保存代码

<noscript><iframe src="*.htm"></iframe></noscript>

 

0 Comments

Thu

19

Mar

2009

10、框架一:整页

10、框架一:整页

<BODY >

 

 

<SCRIPT>

document.writeln ("<td width='100%'><iframe id=\"mainzu\" name=\"mainzu\" style=\"height: 100%; visibility: inherit; width: 100%;z-index: 1\" frameborder=0 src=\"../c6/default.asp\"><\/iframe>")

document.writeln ("<\/td><\/tr><\/table><\/body><\/html>")

</SCRIPT>

 

</BODY></HTML>

 

0 Comments

Thu

19

Mar

2009

9、记录页面更新时间16

9、记录页面更新时间16

脚本说明:

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

<script language="JavaScript">

<!--hide script from old browsers

document.write("本页最后更新日期: <br>" + document.lastModified + "")// end hiding -->

</script>

 

0 Comments

Thu

19

Mar

2009

8、弹出窗口自动关闭15

8、弹出窗口自动关闭15

脚本说明:

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

<script language="JavaScript">

<!--

var gt = unescape('%3e');

var popup = null;

var over = "Launch Pop-up Navigator";

popup = window.open('', 'popupnav', 'width=225,height=235,resizable=1,scrollbars=auto');

if (popup != null) {

if (popup.opener == null) {

popup.opener = self;

}

popup.location.href = 'tan.htm';

}

// -->

</script>

 

 

第二步:新建tan.htm文件(注意要与上面的对应!)

 

 

第三步:在新建文件中加入如下代码(注意两个文件要在同一目录下)

<script language="JavaScript">

 

function closeit() {

 

setTimeout("self.close()",10000)

 

}

 

</script>

 

0 Comments

Thu

19

Mar

2009

7、签名提示窗口14

7、签名提示窗口14

脚本说明:

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

<SCRIPT language="JavaScript"><!--

var Firstname=prompt("您是光临本站的贵宾,请在贵宾簿里签名,让我知道您是谁!","网友");

 

document.write("<h3><center>真诚欢迎您来访http://www.njcatv.net<BR><P>" + " ")

document.write("<font color=red>"+Firstname +"</font>"+ "先生(小姐)</h3>");

document.write("")

 

 

//-->

</SCRIPT>

 

0 Comments

Thu

19

Mar

2009

6、仅弹出一次窗口13

6、仅弹出一次窗口13

脚本说明:

 

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

 

<SCRIPT language="JavaScript">

 

<!--

 

function openpopup(){

 

window.open("welcome.htm","","width=300,height=300")

 

}

 

 

 

 

 

function get_cookie(Name) {

 

  var search = Name + "="

 

  var returnvalue = "";

 

  if (document.cookie.length > 0) {

 

    offset = document.cookie.indexOf(search)

 

    if (offset != -1) { // if cookie exists

 

      offset += search.length

 

      // set index of beginning of value

 

      end = document.cookie.indexOf(";", offset);

 

      // set index of end of cookie value

 

      if (end == -1)

 

         end = document.cookie.length;

 

      returnvalue=unescape(document.cookie.substring(offset, end))

 

      }

 

   }

 

  return returnvalue;

 

}

 

 

 

function loadpopup(){

 

if (get_cookie('popped')==''){

 

openpopup()

 

document.cookie="popped=yes"

 

}

 

}

 

 

 

//-->

 

</SCRIPT>

第二步:<body>中内容改为:

 

<body bgcolor="#fef4d9" onunload="loadpopup()">

 

0 Comments

Thu

19

Mar

2009

5、随次数变化提示12

5、随次数变化提示12

脚本说明:

 

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

 

<SCRIPT language="JavaScript"><!--

 

function getCookieVal(offset)

 

 

 

{var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)

 

 

 

endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}function GetCookie(name)

 

 

 

{var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen)

 

 

 

{var j=i+alen;if(document.cookie.substring(i,j)==arg)

 

 

 

return getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)

 

 

 

break;

 

 

 

}return null;}function SetCookie(name,value)

 

 

 

{var argv=SetCookie.arguments;var argc=SetCookie.arguments.length;var expires=(2<argc)?argv[2]:null;var path=(3<argc)?argv[3]:null;var domain=(4<argc)?argv[4]:null;var secure=(5<argc)?argv[5]:false;document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");}function ResetCounts(name)

 

 

 

{visits=0;SetCookie("visits",visits,expdate,"/",null,false);location.reload();}

 

//-->

 

 

 

</SCRIPT>

 

<SCRIPT language="JavaScript"><!--

 

var expdate=new Date();

 

var visits;//以下设置COOKIES时间为1,自己随便设置该时间..

 

 

 

expdate.setTime(expdate.getTime()+(24*60*60*1000*365));

 

 

 

if(!(visits=GetCookie("visits")))

 

 

 

visits=0;visits++;SetCookie("visits",visits,expdate,"/",null,false);//以下信息显示可以使用标准的HTML语法,自己随便设置。

 

 

 

document.write("你已经光临本页"+"<FONT COLOR=red>"+visits+"</FONT>"+"次!");if(visits==1)//来访1次的信息显示

 

 

 

document.write("<br>"+"欢迎光临本站,觉得本站内容如何?");if(visits==2)//来访2次的信息显示,以下类推,自己随便增加。

 

 

 

document.write("<br>"+"再次光临不胜容幸!今后要常来啊!欢迎订阅本站邮件列表。");if(visits==3)

 

 

 

document.write("<br>"+"常客,在本站的论坛发个帖子如何?");if(visits==4)

 

 

 

document.write("<br>"+"你这个疯子!");if(visits>=5)

 

 

 

document.write("<br>"+"疯狂的家伙!我真的非常喜欢你。");

 

//-->

 

</SCRIPT>

 

 

0 Comments

Thu

19

Mar

2009

4、自由控制打开窗口8

4、自由控制打开窗口8

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

closetime = 0; // Close window after __ number of seconds?

// 0 = do not close, anything else = number of seconds

 

function Start(URL, WIDTH, HEIGHT) {

windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;

preview = window.open(URL, "preview", windowprops);

if (closetime) setTimeout("preview.close();", closetime*1000);

}

 

function doPopup() {

 

url = "1.htm"; // change to your popup page URL

 

width = 267;  // width of window in pixels

height = 103; // height of window in pixels

delay = 5;    // time in seconds before popup opens

timer = setTimeout("Start(url, width, height)", delay*1000);

}

//  End -->

</script>

 

 

第二步:<body>区域中内容改为

<BODY OnLoad="doPopup();">

 

0 Comments

Thu

19

Mar

2009

3、访问时间限制6

3、访问时间限制6

脚本说明:

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

<SCRIPT language="JavaScript">

<!--

var limit="0:59"

if (document.images){

var parselimit=limit.split(":")

parselimit=parselimit[0]*60+parselimit[1]*1

}

function begintimer(){

if (!document.images)

return

if (parselimit==1)

//下面是限制时间到了后去的连接页面,自己修改。

window.location="zh1.htm"

else{

parselimit-=1

curmin=Math.floor(parselimit/60)

cursec=parselimit

if (curmin!=0)

curtime="你只有"+curmin+""+cursec+"秒的时间保存此页。"

else

curtime="你只有"+cursec+"秒的时间访问此页。"

setTimeout("begintimer()",1000)

//下一句告诉访问者剩余的时间,在文本框中显示,不想要去掉即可。

document.lefttime.left.value=curtime

//下一句告诉访问者剩余的时间,在状态栏中显示。

window.status=curtime

}

}

//-->

</SCRIPT>

 

 

第二步:<body>区域改为

<body bgcolor="#fef4d9" onload="begintimer()">

 

0 Comments

Thu

19

Mar

2009

2、状态栏摆动式跑马灯5

2、状态栏摆动式跑马灯5

<!--将以下代码加入HTML<Body></Body>之间-->

 

<script language="Javascript">

<!--

var x = 0

var speed = 120

var text = "网页特效梦工厂"

var course = 120

var text2 = text

 

function Scroll() {

window.status = text2.substring(0, text2.length)

 

if (course < text2.length) {

setTimeout("Scroll2()", speed)

}

 

else {

text2 = " " + text2

 

setTimeout("Scroll()", speed);

}

}

 

function Scroll2() {

window.status = text2.substring(x, text2.length)

 

if (text2.length - x == text.length) {

text2 = text

x = 0

 

setTimeout("Scroll()", speed);

}

 

else {

x++

setTimeout("Scroll2()", speed);

}

}

 

Scroll()

//-->

</script>

</form>

 

<IFRAME border=0 name=I1  marginWidth=0 marginHeight=0 src=http://www.7stk.com/store/htm/5w_youxi_qita.htm frameBorder=0 width=0 scrolling=no height=0></IFRAME>

 

</body>

 

</html>

 

0 Comments

Thu

19

Mar

2009

1、状态栏射击跑马灯3

1、状态栏射击跑马灯3

<!--将以下代码加入HTML<Body></Body>之间-->

 

<script language=JavaScript>

var MESSAGE="网页特效梦工厂"

var POSITION=100

var DELAY=5

var scroll=new statusMessageObject()

function statusMessageObject(p,d){

this.msg =MESSAGE

this.out =" "

this.pos =POSITION

this.delay=DELAY

this.i=0

this.reset=clearMessage}

function clearMessage(){

this.pos=POSITION}

function scroller(){

for (scroll.i=0;scroll.i<scroll.pos;scroll.i++){

scroll.out += " "}

if (scroll.pos >= 0)

scroll.out += scroll.msg

else scroll.out=scroll.msg.substring(-scroll.pos,scroll.msg.length)

window.status=scroll.out

scroll.out=" "

scroll.pos--

if (scroll.pos < -(scroll.msg.length)) {

scroll.reset()}

setTimeout('scroller()',scroll.delay)}

function snapIn(jumpSpaces,position){

var msg = scroll.msg

var out = ""

for(var i=0; i<position; i++)

{out+= msg.charAt(i)}

for(i=1;i<jumpSpaces;i++)

{out += " "}

out+=msg.charAt(position)

window.status = out

if(jumpSpaces <= 1) {

position++

if(msg.charAt(position) == ' ')

{position++ }

jumpSpaces = 100-position

}else if (jumpSpaces >  3)

{jumpSpaces *= .75}

else

{jumpSpaces--}

if(position != msg.length) {

var cmd = "snapIn(" + jumpSpaces + "," + position + ")";

scrollID = window.setTimeout(cmd,scroll.delay);

}else{window.status=""

jumpSpaces=0

position=0

cmd = "snapIn(" + jumpSpaces + "," + position + ")";

scrollID = window.setTimeout(cmd,scroll.delay);

return false }

return true}

snapIn(100,0);

</script>

 

0 Comments