Wed

18

Mar

2009

30、问卷调查脚本

30、问卷调查脚本

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

 

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

 

<SCRIPT language=JavaScript>

 

function processForm(form){

 

var xf=xf1=0;

 

hc=new Array(20);

 

var roll_call=hc.length;

 

for (i=roll_call;i>0;i--)

 

{hc[i-1]=1};

 

//loops through the radio buttons finding out which one is selected

 

if (form.c1[1].checked==1) hc[0]=2;

 

if (form.c1[2].checked==1) hc[0]=3;

 

if (form.c1[3].checked==1) hc[0]=4;

 

if (form.c2[1].checked==1) hc[1]=2;

 

if (form.c2[2].checked==1) hc[1]=3;

 

if (form.c2[3].checked==1) hc[1]=4;

 

if (form.c3[1].checked==1) hc[2]=2;

 

if (form.c3[2].checked==1) hc[2]=3;

 

if (form.c3[3].checked==1) hc[2]=4;

 

if (form.c4[1].checked==1) hc[3]=2;

 

if (form.c4[2].checked==1) hc[3]=3;

 

if (form.c4[3].checked==1) hc[3]=4;

 

if (form.c5[0].checked==1) hc[4]=4;

 

if (form.c5[1].checked==1) hc[4]=3;

 

if (form.c5[2].checked==1) hc[4]=2;

 

if (form.c6[1].checked==1) hc[5]=2;

 

if (form.c6[2].checked==1) hc[5]=3;

 

if (form.c6[3].checked==1) hc[5]=4;

 

if (form.c7[1].checked==1) hc[6]=2;

 

if (form.c7[2].checked==1) hc[6]=3;

 

if (form.c7[3].checked==1) hc[6]=4;

 

if (form.c8[1].checked==1) hc[7]=2;

 

if (form.c8[2].checked==1) hc[7]=3;

 

if (form.c8[3].checked==1) hc[7]=4;

 

if (form.c9[0].checked==1) hc[8]=4;

 

if (form.c9[1].checked==1) hc[8]=3;

 

if (form.c9[2].checked==1) hc[8]=2;

 

if (form.c10[1].checked==1) hc[9]=2;

 

if (form.c10[2].checked==1) hc[9]=3;

 

if (form.c10[3].checked==1) hc[9]=4;

 

if (form.c11[1].checked==1) hc[10]=2;

 

if (form.c11[2].checked==1) hc[10]=3;

 

if (form.c11[3].checked==1) hc[10]=4;

 

if (form.c12[1].checked==1) hc[11]=2;

 

if (form.c12[2].checked==1) hc[11]=3;

 

if (form.c12[3].checked==1) hc[11]=4;

 

if (form.c13[0].checked==1) hc[12]=4;

 

if (form.c13[1].checked==1) hc[12]=3;

 

if (form.c13[2].checked==1) hc[12]=2;

 

if (form.c14[1].checked==1) hc[13]=2;

 

if (form.c14[2].checked==1) hc[13]=3;

 

if (form.c14[3].checked==1) hc[13]=4;

 

if (form.c15[1].checked==1) hc[14]=2;

 

if (form.c15[2].checked==1) hc[14]=3;

 

if (form.c15[3].checked==1) hc[14]=4;

 

if (form.c16[1].checked==1) hc[15]=2;

 

if (form.c16[2].checked==1) hc[15]=3;

 

if (form.c16[3].checked==1) hc[15]=4;

 

if (form.c17[0].checked==1) hc[16]=4;

 

if (form.c17[1].checked==1) hc[16]=3;

 

if (form.c17[2].checked==1) hc[16]=2;

 

if (form.c18[1].checked==1) hc[17]=2;

 

if (form.c18[2].checked==1) hc[17]=3;

 

if (form.c18[3].checked==1) hc[17]=4;

 

if (form.c19[0].checked==1) hc[18]=4;

 

if (form.c19[1].checked==1) hc[18]=3;

 

if (form.c19[2].checked==1) hc[18]=2;

 

if (form.c20[1].checked==1) hc[19]=2;

 

if (form.c20[2].checked==1) hc[19]=3;

 

if (form.c20[3].checked==1) hc[19]=4;

 

for (i=roll_call;i>0;i--)

 

{xf+=hc[i-1]};   

 

xf1=Math.ceil(xf*1.25);

 

form.answer.value="你的得分为"+xf1+"";

 

}</SCRIPT>

 

 

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

 

<TABLE border=0 cellPadding=4 cellSpacing=0 height=79 width=500>

 

  <TBODY>

 

  <TR>

 

    <TD align=middle height=46 width=519><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 6pt">◇◆◇◆◇</SPAN><FONT

 

      color=#0000ff><STRONG><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 12pt; LINE-HEIGHT: 15px">你有焦虑情绪吗</SPAN></STRONG></FONT><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 6pt">◇◆◇◆◇</SPAN></TD></TR>

 

  <TR>

 

    <TD height=18 width=519><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">仔细阅读每一题,然后根据你最近一个星期的实际感觉,选择适合的答案。</SPAN></TD></TR></TBODY></TABLE></DIV>

 

<FORM name=see>

 

<DIV align=left>

 

<TABLE border=0 cellPadding=10 cellSpacing=0 height=388 width=517>

 

  <TBODY>

 

  <TR>

 

    <TD height=1 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">1、觉得比平常容易紧张和着急。<BR><INPUT

 

      name=c1 type=radio value=1>没有或很少时间。<BR><INPUT name=c1 type=radio

 

      value=3>小部分时间。<BR><INPUT name=c1 type=radio value=5>相当多时间。<BR><INPUT

 

      name=c1 type=radio value=V1>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=1 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">2、无缘无故感到害怕。<BR><INPUT

 

      name=c2 type=radio value=11>没有或很少时间。<BR><INPUT name=c2 type=radio

 

      value=31>小部分时间。<BR><INPUT name=c2 type=radio value=51>相当多时间。<BR><INPUT

 

      name=c2 type=radio value=V2>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=1 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">3、容易心里烦乱或觉得惊慌。<BR><INPUT

 

      name=c3 type=radio value=12>没有或很少时间。<BR><INPUT name=c3 type=radio

 

      value=32>小部分时间。<BR><INPUT name=c3 type=radio value=52>相当多时间。<BR><INPUT

 

      name=c3 type=radio value=V3>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">4、觉得可能将要发疯。<BR><INPUT

 

      name=c4 type=radio value=13>没有或很少时间。<BR><INPUT name=c4 type=radio

 

      value=33>小部分时间。<BR><INPUT name=c4 type=radio value=53>相当多时间。<BR><INPUT

 

      name=c4 type=radio value=V4>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">5、觉得一切都很好,也不会发生什么不幸。<BR><INPUT

 

      name=c5 type=radio value=14>没有或很少时间。<BR><INPUT name=c5 type=radio

 

      value=34>小部分时间。<BR><INPUT name=c5 type=radio value=54>相当多时间。<BR><INPUT

 

      name=c5 type=radio value=V5>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">6、手脚发抖打颤。<BR><INPUT

 

      name=c6 type=radio value=15>没有或很少时间。<BR><INPUT name=c6 type=radio

 

      value=35>小部分时间。<BR><INPUT name=c6 type=radio value=55>相当多时间。<BR><INPUT

 

      name=c6 type=radio value=V6>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">7、因为头痛、头颈痛和背痛而苦恼。<BR><INPUT

 

      name=c7 type=radio value=16>没有或很少时间。<BR><INPUT name=c7 type=radio

 

      value=36>小部分时间。<BR><INPUT name=c7 type=radio value=56>相当多时间。<BR><INPUT

 

      name=c7 type=radio value=V7>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">8、感觉容易衰弱和疲乏。<BR><INPUT

 

      name=c8 type=radio value=17>没有或很少时间。<BR><INPUT name=c8 type=radio

 

      value=37>小部分时间。<BR><INPUT name=c8 type=radio value=57>相当多时间。<BR><INPUT

 

      name=c8 type=radio value=V8>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">9、觉得心平气和,并且容易安静地坐着。<BR><INPUT

 

      name=c9 type=radio value=18>没有或很少时间。<BR><INPUT name=c9 type=radio

 

      value=38>小部分时间。<BR><INPUT name=c9 type=radio value=58>相当多时间。<BR><INPUT

 

      name=c9 type=radio value=V9>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">10、觉得心跳得很快。<BR><INPUT

 

      name=c10 type=radio value=19>没有或很少时间。<BR><INPUT name=c10 type=radio

 

      value=39>小部分时间。<BR><INPUT name=c10 type=radio value=59>相当多时间。<BR><INPUT

 

      name=c10 type=radio value=V10>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">11、因为一阵阵头晕而苦恼。<BR><INPUT

 

      name=c11 type=radio value=110>没有或很少时间。<BR><INPUT name=c11 type=radio

 

      value=310>小部分时间。<BR><INPUT name=c11 type=radio value=510>相当多时间。<BR><INPUT

 

      name=c11 type=radio value=V11>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">12、有晕倒发作,或觉得要晕倒似的。<BR><INPUT

 

      name=c12 type=radio value=111>没有或很少时间。<BR><INPUT name=c12 type=radio

 

      value=311>小部分时间。<BR><INPUT name=c12 type=radio value=511>相当多时间。<BR><INPUT

 

      name=c12 type=radio value=V12>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">13、吸气呼气都感到很容易。<BR><INPUT

 

      name=c13 type=radio value=112>没有或很少时间。<BR><INPUT name=c13 type=radio

 

      value=312>小部分时间。<BR><INPUT name=c13 type=radio value=512>相当多时间。<BR><INPUT

 

      name=c13 type=radio value=V13></SPAN><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt">绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">14、手脚麻木和刺痛。<BR><INPUT

 

      name=c14 type=radio value=113>没有或很少时间。<BR><INPUT name=c14 type=radio

 

      value=313>小部分时间。<BR><INPUT name=c14 type=radio value=513>相当多时间。<BR><INPUT

 

      name=c14 type=radio value=V14>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">15、因为胃痛和消化不良而苦恼。<BR><INPUT

 

      name=c15 type=radio value=114>没有或很少时间。<BR><INPUT name=c15 type=radio

 

      value=314>小部分时间。<BR><INPUT name=c15 type=radio value=514>相当多时间。<BR><INPUT

 

      name=c15 type=radio value=V15>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">16、常常要小便。<BR><INPUT

 

      name=c16 type=radio value=115>没有或很少时间。<BR><INPUT name=c16 type=radio

 

      value=315>小部分时间。<BR><INPUT name=c16 type=radio value=515>相当多时间。<BR><INPUT

 

      name=c16 type=radio value=V16>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">17、手常常是干燥温暖的。<BR><INPUT

 

      name=c17 type=radio value=116>没有或很少时间。<BR><INPUT name=c17 type=radio

 

      value=316>小部分时间。<BR><INPUT name=c17 type=radio value=516>相当多时间。<BR><INPUT

 

      name=c17 type=radio value=V17>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">18、脸红发热。<BR><INPUT

 

      name=c18 type=radio value=117>没有或很少时间。<BR><INPUT name=c18 type=radio

 

      value=317>小部分时间。<BR><INPUT name=c18 type=radio value=517>相当多时间。<BR><INPUT

 

      name=c18 type=radio value=V18>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">19、容易入睡并且一夜睡得很好。<BR><INPUT

 

      name=c19 type=radio value=118>没有或很少时间。<BR><INPUT name=c19 type=radio

 

      value=318>小部分时间。<BR><INPUT name=c19 type=radio value=518>相当多时间。<BR><INPUT

 

      name=c19 type=radio value=V19>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD height=35 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">20、作恶梦。<BR><INPUT

 

      name=c20 type=radio value=119>没有或很少时间。<BR><INPUT name=c20 type=radio

 

      value=319>小部分时间。<BR><INPUT name=c20 type=radio value=519>相当多时间。<BR><INPUT

 

      name=c20 type=radio value=V20>绝大部分或全部时间。</SPAN></TD></TR>

 

  <TR>

 

    <TD align=middle height=25 width=517><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px"><INPUT onclick=processForm(this.form) style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt" type=button value=都选择完了,结果怎样?><INPUT

 

      name=answer

 

      style="COLOR: rgb(255,0,0); FONT-FAMILY: 宋体; FONT-SIZE: 9pt"></SPAN></TD></TR></TBODY></TABLE></DIV></FORM>

 

<DIV align=left>

 

<TABLE border=0 cellPadding=4 cellSpacing=0 height=22 width=500>

 

  <TBODY>

 

  <TR>

 

    <TD height=22 width=520><SPAN

 

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px"><FONT

 

      color=#ff0000>说明        

 

      </FONT>你焦虑评定的分界值是50分,分值越高,焦虑倾向越明显。</SPAN></TD></TR></TBODY></TABLE>

 

0 Comments

Wed

18

Mar

2009

29、一个选题,完成后给出结论

29、一个选题,完成后给出结论

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

 

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

 

<SCRIPT language=JavaScript>

 

<!--

 

function processForm(form){

 

if (form.c1[0].checked==1) form.answer.value="把双手放在胸口前往往给人一种害羞、紧张、自我保护的感觉。选择这个姿势的男性就是喜欢这种含羞答答、在紧张时不自觉会手足无措,稍具气质及矜持的女性。";

 

if (form.c1[1].checked==1) form.answer.value="两手垂下给人一种自然、顺从的感觉。选择这个姿势的男性会喜欢不造作、不刻意掩饰自己及带点天真的女性。";

 

if (form.c1[2].checked==1) form.answer.value="两手张开给人一种接纳、包容的感觉。选择这个姿势的男性会倾向喜欢较年长、或是能给予他像母亲的爱般温暖的女性。";

 

}

 

//-->

 

</SCRIPT>

 

 

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

 

<TABLE border=0 cellPadding=4 cellSpacing=0 height=78 width=500>

 

  <TBODY>

 

  <TR>

 

    <TD align=middle height=38 width=561><SPAN

 

      style="FONT-SIZE: 6pt">◇◆◇◆◇</SPAN><SPAN

 

      style="FONT-SIZE: 12pt"><STRONG>哪一类型女仔最吸引你</STRONG></SPAN><SPAN

 

      style="FONT-SIZE: 6pt">◇◆◇◆◇</SPAN></TD></TR></TBODY></TABLE></DIV>

 

<FORM name=see>

 

<DIV align=left>

 

<TABLE border=0 cellPadding=10 cellSpacing=0 height=223 width=517>

 

  <TBODY>

 

  <TR>

 

    <TD height=1 width=517>

 

      <DIV align=left>

 

      <P>假如圣母玛莉亚赤裸站在你面前,你认为她的双手会放在那儿?</P></DIV>

 

      <DIV align=left>

 

      <P><INPUT name=c1 type=radio value=1>放在胸口前。<BR><INPUT name=c1 type=radio

 

      value=3>两手垂下。<BR><INPUT name=c1 type=radio value=V1>两手张开成V字形。

 

  </P></DIV></TD></TR>

 

  <TR>

 

    <TD align=middle height=27 width=517><INPUT onclick=processForm(this.form) style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt" type=button value=已选好,看看结论!></TD></TR>

 

  <TR>

 

    <TD align=middle height=-12 width=517><TEXTAREA cols=47 name=answer rows=5 style="COLOR: rgb(255,0,0); FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">

 

0 Comments

Wed

18

Mar

2009

28、在选题的同时跳出对话框提示

28、在选题的同时跳出对话框提示

0 Comments

Wed

18

Mar

2009

27、这个用来做调查很好

27、这个用来做调查很好

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

<SCRIPT LANGUAGE="JavaScript">

 

<!--

function scorequiz(form) {

 list=0

 if(form.Q1.value!=null && form.Q1.value=="*") {list=list+1}

 if(form.Q2.value!=null && form.Q2.value=="*") {list=list+1}

 if(form.Q3.value!=null && form.Q3.value=="*") {list=list+1}

 if(form.Q4.value!=null && form.Q4.value=="*") {list=list+1}

 if(form.Q5.value!=null && form.Q5.value=="*") {list=list+1}

 if(form.Q6.value!=null && form.Q6.value=="*") {list=list+1}

 if(form.Q7.value!=null && form.Q7.value=="*") {list=list+1}

 if(form.Q8.value!=null && form.Q8.value=="*") {list=list+1}

 if(form.Q9.value!=null && form.Q9.value=="*") {list=list+1}

 if(form.Q10.value!=null && form.Q10.value=="*") {list=list+1}

 form.SCORE.value =eval(list)

     if (form.SCORE.value<=8){

    ok="不及格!"}

}

 

function clearquiz(form) {

 list=0

 form.Q1.value="?"

 form.Q2.value="?"

 form.Q3.value="?"

 form.Q4.value="?"

 form.Q5.value="?"

 form.Q6.value="?"

 form.Q7.value="?"

 form.Q8.value="?"

 form.Q9.value="?"

 form.Q10.value="?"

 form.SCORE.value =eval(list)

}

 

function msg() {

 alert("感谢参加测试,您的成绩已经将mailWebmaster")

 }

// -->

 

</SCRIPT>

 

 

 

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

<table width="75%" border="0" align="center">

  <tr>

    <td>

      <form name="quiz1"

 action ="mailto:webmaster@javascript2000.com?subject=测试结果反馈" method="post" enctype="text/plain"

 onLoad="clearquiz(this.form)" onSubmit="msg()">

        您的姓名:

        <input type="Text" name="Name" value="" class="pt9">

        <br>

        <hr>

        1. Internet上使用的网络协议是:__________

        <ol>

          <input type="radio" name="Q1" value="*TCP/IP" onClick=Q1.value="*">

          TCP/IP<br>

          <input type="radio" name="Q1" value="X.25" onClick=Q1.value="X.25">

          X.25<br>

          <input type="radio" name="Q1" value="NetBEUI" onClick=Q1.value="NetBEUI">

          NetBEUI<br>

        </ol>

        2. 我们通过__________长距离连接两台计算机使它们通讯。

        <ol>

          <input type="radio" name="Q2" value="LAN" onClick=Q2.value="A">

          LAN<br>

          <input type="radio" name="Q2" value="*WAN" onClick=Q2.value="*">

          WAN<br>

          <input type="radio" name="Q2" value="WAIS" onClick=Q2.value="C">

          WAIS<br>

        </ol>

        3. HUB是指:__________

        <ol>

          <input type="radio" name="Q3" value="网关" onClick=Q3.value="网关">

          网关<br>

          <input type="radio" name="Q3" value="网桥" onClick=Q3.value="网桥">

          网桥<br>

          <input type="radio" name="Q3" value="路由器" onClick=Q3.value="路由器">

          路由器<br>

          <input type="radio" name="Q3" value="*集线器" onClick=Q3.value="*">

          集线器<br>

        </ol>

        4. 56K MODEM的传输速度为:__________

        <ol>

          <input type="radio" name="Q4" value="56Kbytes" onClick=Q4.value="A">

          每秒传输56K bytes的数据。 <br>

          <input type="radio" name="Q4" value="*56kbps" onClick=Q4.value="*">

          每秒传输56k bits的数据。 <br>

        </ol>

        5. Gateway是指:__________

        <ol>

          <input type="radio" name="Q5" value="*网关" onClick=Q5.value="*">

          网关<br>

          <input type="radio" name="Q5" value="网桥" onClick=Q5.value="B">

          网桥<br>

          <input type="radio" name="Q5" value="路由器" onClick=Q5.value="C">

          路由器<br>

          <input type="radio" name="Q5" value="集线器" onClick=Q5.value="D">

          集线器<br>

        </ol>

        6. Http默认的端口是:__________

        <ol>

          <input type="radio" name="Q6" value="8080" onClick=Q6.value="A">

          8080<br>

          <input type="radio" name="Q6" value="*80" onClick=Q6.value="*">

          80<br>

          <input type="radio" name="Q6" value="25" onClick=Q6.value="25">

          25<br>

        </ol>

        7. JavaScript是一种类似于C++的语言,比较难掌握:__________

        <ol>

          <input type="radio" name="Q7" value="True" onClick=Q7.value="T">

          True<br>

          <input type="radio" name="Q7" value="*False" onClick=Q7.value="*">

          False<br>

        </ol>

        8. JAVA __________ 公司的产品:

        <ol>

          <input type="radio" name="Q8" value="Microsoft" onClick=Q8.value="A">

          Microsoft<br>

          <input type="radio" name="Q8" value="Novell" onClick=Q8.value="B">

          Novell<br>

          <input type="radio" name="Q8" value="*SUN" onClick=Q8.value="*">

          SUN<br>

        </ol>

        9. CGI通过__________收集用户填写的表单信息:

        <ol>

          <input type="radio" name="Q9" value="Form" onClick=Q9.value="A">

          Form<br>

          <input type="radio" name="Q9" value="*环境变量" onClick=Q9.value="*">

          环境变量<br>

          <input type="radio" name="Q9" value="javascripts脚本" onClick=Q9.value="C">

          javascripts脚本<br>

        </ol>

        10. 服务器响应"404 error"的含义是: __________

        <ol>

          <input type="radio" name="Q10" value="*文件不存在" onClick=Q10.value="*">

          文件不存在<br>

          <input type="radio" name="Q10" value="Server error" onClick=Q10.value="B">

          服务器错误<br>

          <input type="radio" name="Q10" value="Client error" onClick=Q10.value="C">

          浏览器错误<br>

        </ol>

        <hr>

        <input type="button" name="submit" value="开始评分" onClick=scorequiz(this.form) class="pt9">

        <input type="reset" name="reset" value="重新测试" onClick=clearquiz(this.form) class="pt9">

        <input type="submit" value="将成绩MAIL给管理员" onClick=scorequiz(this.form) name="submit" class="pt9">

        <br>

        <br>

        你的考试成绩:

        <input  name="SCORE" type="text" class="pt9">

      </form>

</td>

  </tr>

</table>

 

 

0 Comments

Tue

17

Mar

2009

26、测试网页的链接速度

26、测试网页的链接速度

<script language="">

 

tim=1

setInterval("tim++",100)

b=1

var autourl=new Array()

autourl[2]="http://free.2259.com"

autourl[1]="http://www.c0.com.cn"

function butt(){

document.write("<form name=autof>")

for(var i=1;i<autourl.length;i++)document.write("<input type=text name=txt"+i+" size=10 value=测试中……  class=buttonface>==><input type=text name=url"+i+" size=60 class=buttonface><br>")

document.write("<input type=button value=重新测试速度 onclick=top.location=self.location class=buttonface></form>")

}

butt()

function auto(url){

document.forms[0]["url"+b].value=url

if(tim>200)

{document.forms[0]["txt"+b].value="链接超时"}

else

{document.forms[0]["txt"+b].value="时间"+tim/10+""}

b++

}

function run(){for(var i=1;i<autourl.length;i++)document.write("<img src="+autourl[ i ]+"/"+Math.random()+" width=1 height=1 onerror=auto('"+autourl[ i ]+"')>")}

run()

</script>

 

 

0 Comments

Tue

17

Mar

2009

25、测试网站进入速度很实用

25、测试网站进入速度很实用

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

 

<SCRIPT>         

if (document.all&&window.spotlight){         

var x=new Array()         

var direction=new Array()         

var y=new Array()         

if (spotlight.length==null){         

spotlight[0]=document.all.spotlight         

x[0]=0         

direction[0]="right"          

y[0]=spotlight[0].height         

spotlight[0].filters.light.addPoint(100,50,100,255,255,255,90)         

}         

else         

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

x[i]=0         

direction[i]="right"         

y[i]=spotlight[i].height         

spotlight[i].filters.light.addPoint(100,50,100,255,255,255,90)         

}         

}         

         

function slidelight(cur){         

spotlight[cur].filters.light.MoveLight(0,x[cur],y[cur],200,-1)         

         

if (x[cur]<spotlight[cur].width+200&&direction[cur]=="right")         

x[cur]+=10         

else if (x[cur]>spotlight[cur].width+200){         

direction[cur]="left"         

x[cur]-=10         

}         

else if (x[cur]>-200&&x[cur]<-185){         

direction[cur]="right"         

x[cur]+=10         

}         

else{         

x[cur]-=10         

direction[cur]="left"         

}         

}         

         

if (document.all&&window.spotlight){         

if (spotlight.length==null)         

setInterval("slidelight(0)",spotlight[0].speed)         

else         

for (t=0;t<spotlight.length;t++){         

var temp='setInterval("slidelight('+t+')",'+spotlight[t].speed+')'         

eval(temp)         

}         

}         

</SCRIPT>

<P>这个脚本可以使你方便得获得各网站的连接速度,用来做镜像站导航效果不错

<SCRIPT>

tim=1

setInterval("tim++",100)

b=1

var autourl=new Array()

autourl[1]="www.2259.com"

autourl[2]="www.sina.com.cn"

autourl[3]="www.163.com"

autourl[4]="www.sohu.com.cn"

autourl[5]="www.c0.com.cn"

function butt(){

document.write("<form name=autof>")

for(var i=1;i<autourl.length;i++)document.write("<input type=text name=txt"+i+" size=10 value=测试中……> <font color=33ff33></font><input type=text name=url"+i+" size=45> <font color=33ff33></font><input type=button value=进入  onclick=window.open(this.form.url"+i+".value)><br>")

document.write("</form>")

}

butt()

function auto(url){

document.forms[0]["url"+b].value=url

if(tim>200)

{document.forms[0]["txt"+b].value="链接超时"}

else

{document.forms[0]["txt"+b].value="时间"+tim/10+""}

b++

}

function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl[i]+"/"+Math.random()+" width=1 height=1 onerror=auto('http://"+autourl[i]+"')>")}

run()

</SCRIPT>

 

 

0 Comments

Tue

17

Mar

2009

24、健康值测试

24、健康值测试

<script LANGUAGE="JAVASCRIPT">

<!-- hide this script tag's contents from old browsers

function ClearForm(form){

form.weight.value = "";

form.height.value = "";

form.bmi.value = "";

form.my_comment.value = "";

}

function bmi(weight, height) {

bmindx=weight/eval(height*height);

return bmindx;

}

function checkform(form) {

if (form.weight.value==null||form.weight.value.length==0

|| form.height.value==null||form.height.value.length==0){

alert("\n哈哈!你比我还要疯,数字都不会输");

 return false;

 }

else if (parseFloat(form.height.value) <= 0||

parseFloat(form.height.value) >=500||

parseFloat(form.weight.value) <= 0||

parseFloat(form.weight.value) >=500){

alert("\n老河生产的这个机器可不是成能的 \n你输的天数字我头都大了 \n快改正一下,再测试一遍……");

ClearForm(form);

 return false;

 }

 return true;

}

function computeform(form) {

if (checkform(form)) {

yourbmi=Math.round(bmi(form.weight.value, form.height.value/100));

form.bmi.value=yourbmi;

if (yourbmi >30) {

form.my_comment.value="不要在闹了!!!哪有这种身材";

 

       }

else if (yourbmi >28 && yourbmi <=30) {

 form.my_comment.value="您是猪吗?";

 

       }

 

else if (yourbmi >23 && yourbmi <=28) {

form.my_comment.value="两头猪也没有你这么重吧?";

 

}

else if (yourbmi >21 && yourbmi <=23) {

form.my_comment.value="我敢打赌,你一定经常抢吃的,不然不会偏胖";

}

 

else if (yourbmi >=19 && yourbmi <=21) {

form.my_comment.value="!!!您棒级了!是标准身材,你是不是女孩子,小心会有很多人爱上你喽";

 

 }

 

else if (yourbmi >=18 && yourbmi <19) {

 

 form.my_comment.value="朋友你是不是吃草的,很明显的营养不良?????";

 

 }

 

 else if (yourbmi >=17 && yourbmi <18) {

 form.my_comment.value="这个不是火柴杆吗????";

 }

 

 else if (yourbmi <17) {

 form.my_comment.value="按照生物学来说这种生物是不能生存的";

  }

  }

return;

 

  }

 // -- done hiding from old browsers -->

</script>

 

<form NAME="BMI" method="POST">

 

<div align="center">

  <center>

 

  <table border="1" bordercolorlight="#808080" cellspacing="1" bordercolordark="#FFFFFF" bgcolor="#F0F0F0" width="613">

 

    <tr>

 

      <td width="72"><div align="center"><center><p>体重 (kg) 

          </div>

        </center></td>

 

      <td align="center" width="64"><div align="center"><center><p>身高(cm)

          </div>

        </center></td>

 

      <td align="center" width="55"><div align="center"><center><p>健康值

          </div>

        </center></td>

 

      <td align="center" width="313"><div align="center"><center><p>电脑对您的评价

          </div>

        </center></td>

 

      <td align="center" width="75"><input TYPE="reset" VALUE=" "

 

  onClick="ClearForm(this.form)"> </td>

 

    </tr>

 

    <tr align="center">

 

      <td width="72"><input TYPE="TEXT" NAME="weight" SIZE="6" onFocus="this.form.weight.value=''"></td>

 

      <td width="64"><input TYPE="TEXT" NAME="height" SIZE="6" onFocus="this.form.height.value=''"></td>

 

      <td width="55"><input TYPE="TEXT" NAME="bmi" SIZE="5"></td>

 

      <td width="313"><input TYPE="TEXT" NAME="my_comment" size="40"></td>

 

      <td width="75"><input TYPE="button" VALUE=" "

 

  onClick="computeform(this.form)"></td>

 

    </tr>

 

  </table>

 

  </center>

</div>

 

  <div align="center"><center><p>  </p>

 </center></div>

</form>

 

0 Comments

Tue

17

Mar

2009

23、非常棒的射击游戏

23、非常棒的射击游戏

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

<head>

<title>网页特效---打蜜蜂</title>

</head><body>

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

 

<SCRIPT LANGUAGE="JavaScript">

var timerID = null;

var patno = 1;

var cr = "\r\n";

var spcf1 = "";

var spcf2 = "";

var spcf3 = "";

var hitflag = 0;

var score = 0;

var selec = 0;

var rsmiss = "";

function array1(arn) {

this.length = arn;

for (var ar1 = 0; ar1 <= arn; ar1++) {

this[ar1] = 1; }

return this;

}

function init() {

blankx = new array1(63);

for (var makeblank = 0; makeblank < 63; makeblank++) {

blankx[makeblank] = "";

for (var addBlank = 0; addBlank < makeblank; addBlank++) {

blankx[makeblank] = blankx[makeblank] + " ";

   }

}

faker = new array1(24);

face = new array1(2);

face[1] = " (O_O) ";

face[2] = " (o_o) ";

mestotal = new array1(4);

interval1();

}

function restarter() {

inplay = 0;

blankno = 0;

totalblank = "";

lr = 1;

lowerlf = "";

downlf = "";

downno = 0;

missilex = 99;

missiley = 99;

mychrx = 1;

myblank = "";

mymove = 0;

selec = 1;

starter();

}

function starter() {

document.fmark.win.value=cr+cr+cr+cr+cr+cr+cr+cr+cr+cr

+"打蜜蜂游戏"+cr+cr+cr

+"请单击发射开始游戏";

selec = 1;

}

function goleft() {

mymove = 0;

mychrx = mychrx - 1;

if (mychrx <= 0) { mychrx = 1; }

}

function goright() {

mymove = 0

mychrx = mychrx + 1;

if (mychrx >= 56) { mychrx = 55; }

}

function golmax() {

if (inplay == 1) { mymove = -1; }

}

function gormax() {

if (inplay == 1){ mymove = 1; }

}

function fire() {

if (inplay == 0){ if (selec == 1){ selec = 9; inplay = 1; init(); }

} else {

if (missiley == 99){ missiley = 18; missilex = mychrx + 3; }

   }

}

function gameover() {

score = 0;

for (var enerme = 1; enerme < 25; enerme++) {

if (faker[enerme] == 1){ score = score + 1; }

}

if (score == 0) {

document.fmark.win.value = cr+cr+cr+cr+cr+cr+cr+cr

+"                        Congratulations!"+cr+cr

+"                          YOU STOPPED THE ENEMY SQUAD!!";

} else {

document.fmark.win.value=cr+cr+cr+cr+cr+cr+cr+cr

+"                           GAME OVER"+cr+cr

+"                   "+score+" INVADERS GOT THROUGH";

}

inplay = 0;

}

function interval1() {

if (missiley != 99) { missiley = missiley - 1; }

if (missiley < 0){ missiley = 99; }

mychrx = mychrx + mymove;

if (mychrx <= 0){ mychrx = 1; }

if (mychrx >= 56){ mychrx = 55; }

blankno = blankno + lr;

totalblank = blankx[blankno];

if (blankno >= 20) { lr = -1; downno = downno + 1; blankno = 20; }

if (blankno <= 0) { lr = 1; downno = downno + 1; blankno = 0; }

if (downno >= 12) { gameover(); }

downlf = "";

for (var upperspc = 0; upperspc < downno; upperspc++) {

if (missiley == upperspc) {

downlf = downlf + blankx[missilex]+"|"+cr;

} else { downlf = downlf+cr; }

   }

if (inplay == 1) {

patno = patno + 1;

if (patno >= 3) { patno = 1; }

for (var addline = 1; addline < 5; addline++){

mestotal[addline] = totalblank;

rsmiss = "";

if (missiley == (downno+addline*2-2)) {

if (blankno <= missilex) {

hitflag = parseInt((missilex-blankno)/7, 10);

if (hitflag < 6) {

if ((missilex - blankno - (hitflag * 7)) >= 1) {

if ((missilex - blankno - (hitflag * 7)) <= 5) {

if (faker[(addline * 6) + hitflag - 5] == 1) {

faker[(addline * 6) + hitflag - 5] = 0;

missiley = 99;

         }

      }

   }

}else {

if (missilex > (blankno + 42)) {

rsmiss = blankx[missilex - blankno - 42]+"|";

      }

   }

} else {

mestotal[addline] = blankx[missilex]+"|";

if (missilex < (blankno-1)) {

mestotal[addline] = mestotal[addline]+blankx[blankno-1-missilex];

      }

   }

}

for (var addfaker = 1; addfaker < 7; addfaker++) {

if (faker[(addline*6)+addfaker-6] == 1) {

mestotal[addline] = mestotal[addline]+face[patno];

} else { mestotal[addline] = mestotal[addline]+"       "; }

}

mestotal[addline] = mestotal[addline]+rsmiss;

}

spcf1 = cr;

spcf2 = cr;

spcf3 = cr;

if (missiley == (downno+1)) { spcf1 = blankx[missilex]+"|"+cr; }

if (missiley == (downno+3)) { spcf2 = blankx[missilex]+"|"+cr; }

if (missiley == (downno+5)) { spcf3 = blankx[missilex]+"|"+cr; }

lowerlf = "";

for (var lowerspc = 0; lowerspc < (11-downno); lowerspc++) {

if (missiley == (downno+7+lowerspc)) {

lowerlf = lowerlf+blankx[missilex]+"|"+cr;

} else { lowerlf = lowerlf+cr; }

}

myblank = blankx[mychrx];

document.fmark.win.value = downlf+mestotal[1]+cr+spcf1

+mestotal[2]+cr+spcf2+mestotal[3]+cr+spcf3+mestotal[4]

+cr+lowerlf+myblank+""+cr+myblank+"(^_^)";

timerID = setTimeout("interval1()",250);

   }

}

</script>

<center>

<form method=post name=fmark>

<table border=1 cellspacing=0 cellpadding=0>

<tr><td align=center>

<textarea name=win rows=20 cols=63 wrap=virtual>

 

 

0 Comments

Tue

17

Mar

2009

22、脑筋急转弯

22、脑筋急转弯

<html>

<head><STYLE type=text/css>.t9pt {

       FONT-SIZE: 9pt

}

A {

       COLOR: black; FONT-SIZE: 9pt; FONT-STYLE: normal; TEXT-DECORATION: none

}

A:hover {BACKGROUND:#ffffff;font-style:normal;text-decoration:none;font-size:9pt;color:red

}

A:active {

       COLOR: #00ccff; FONT-SIZE: 9pt; FONT-STYLE: normal; TEXT-DECORATION: underline

}

TABLE {

       FONT-SIZE: 9pt

}

</STYLE>

<title>星幻-IQ自测</title>

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

<script language="JavaScript">

<!--

function MM_popupMsg(msg) { //v1.0

  alert(msg);

}

//-->

</script>

</head>

 

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

<hr> 

<div align="center">

  <center>

    <table width="100%" border=0 height="260">

      <tbody>

      <tr>

        <td width="81%" height=263>

          <form>

            <table bordercolor=#000000 cellspacing=0 cellpadding=0 width="100%"

            border=0>

              <tbody>

              <tr>

                <td width="91%" height="40"> 一只凶猛的饿猫,看到老鼠,为何拔腿就跑?</td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:去抓老鼠')" type=button value=答案 name=button>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 公共汽车来了,一位穿常裙的小姐投了4 元,司机让她上车;第二位穿迷你裙的小姐,投了2元,司机也让她上车;第三位小姐沒给钱,司机也照样让她上车,为什么?<br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案是:她是售票员')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 书店里买不到什么书 <br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:遗书')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 一年四季都盛开的花是什么花?<br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:塑料花')" type=button value=答案 name=button22>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 为什么大雁秋天要飞到南方去? <br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:如果走就太慢了')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 小陈周末去看电影,到了电影院,却看不到半个人,为什么? <br>

                  <br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:人都是一个一个的,没有半个')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 一群女孩在正在河边洗澡,突然一陌生男人闯入,你觉得她们最想遮住哪儿?

                  <br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:男人的眼睛')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 一头公牛加一头母牛,猜三个字? <br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:两头牛')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 猪的全身都是宝,用处很大,猪对人类还有什么用处? <br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:它的名字可以骂人\r')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 为什么老王家的马能吃掉老张家的象? <br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:他们在下象棋')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 用什么可以解开所有的谜? <br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:谜底')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              <tr>

                <td width="91%" height="40"> 有什么东西人们都不喜欢吃?<br>

                </td>

                <td width="9%" height="40">

                  <div align=right>

                    <input onClick="MM_popupMsg('答案:吃亏。')" type=button value=答案 name=button2>

                  </div>

                </td>

              </tr>

              </tbody>

            </table>

          </form>

        </td>

      </tr>

      </tbody>

    </table>

   

  </center>

</div>

<hr>

</body>   

</html>   

 

0 Comments

Tue

17

Mar

2009

21、字符在FORM中坠落

21、字符在FORM中坠落

脚本说明:

 

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

 

<script language="javascript">

 

 

 

function drip(){

 

        wordy="南京有线宽带网";

 

        document.hey.a.value="";

 

        document.hey.b.value="";

 

        document.hey.c.value="";

 

        document.hey.d.value="";

 

        word="";

 

        beat=0;

 

        aa=0;

 

        bb=0;

 

        cc=0;

 

        dd=0;

 

        lo=wordy.length;

 

        drop();

 

}

 

function drop(){

 

        if(beat<=lo*3+1){

 

        beat=beat+1;

 

        if(beat<=1){

 

                document.hey.a.value=wordy;

 

        }

 

        if(beat>1&&beat<=lo+1){

 

                fin="";

 

                aa=aa+1;

 

                for(var x=0;x<=aa-1;x++){

 

                        fin=fin+" ";

 

                }

 

                fin=fin+wordy.substring(aa,lo);

 

                document.hey.a.value=fin;

 

                document.hey.b.value=wordy.substring(0,aa);

 

        }

 

        if(beat>lo+1&&beat<=lo*2+1){

 

                fin="";

 

                bb=bb+1;

 

                for(var x=0;x<=bb-1;x++){

 

                        fin=fin+" ";

 

                }

 

                fin=fin+wordy.substring(bb,lo);

 

                document.hey.b.value=fin;

 

                document.hey.c.value=wordy.substring(0,bb);

 

        }

 

        if(beat>lo*2+1&&beat<=lo*3+1){

 

                fin="";

 

                cc=cc+1;

 

                for(var x=0;x<=cc-1;x++){

 

                        fin=fin+" ";

 

                }

 

                fin=fin+wordy.substring(cc,lo);

 

                document.hey.c.value=fin;

 

                document.hey.d.value=wordy.substring(0,cc);

 

        }

 

        setTimeout("drop()",200);

 

        }

 

        else{

 

                document.hey.d.value=wordy;

 

        }

 

}

 

 

 

</script>

 

<form name="hey">

 

<input type="text" name="a" size=12><br>

 

<input type="text" name="b" size=12><br>

 

<input type="text" name="c" size=12><br>

 

<input type="text" name="d" size=12><br><BR>

 

<input type="button" name="start" value="Start" onclick="drip()">

 

 

0 Comments

Tue

17

Mar

2009

20、射击小游戏

20、射击小游戏

脚本说明:

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

 <SCRIPT LANGUAGE="JavaScript">

 

 

 // ---- Make array

 function MakeArray( n){

     this.length = n;

     for (var i = 1; i <= n; i++) {

         this[i] = 0

     }

     return this

 }

 

 // ----- poor man's random number

 var d0 = new Date();

 var r0 = d0.getSeconds();

 function poor_rand(){

     d1 = new Date();

     r0 = (r0 * r0 + r0 + d1.getSeconds()) % 3721 ;

     return r0 % width_n;

 }

 

 // ---- Parameters of game

 var height_n = 8;

 var width_n =5;

 

 // ---- state of game

 var enemy = new MakeArray( width_n); // enemy positions

 var wtime; // wait time

 var score; // points

 var gameover; // in case of gameover set to true

 

 // ----- Make the battlefield.

 document.write( "<FORM NAME='fm1'>");

 document.write( "<INPUT TYPE='text' NAME='message' SIZE=20>");

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

 document.write( "<FORM NAME='fm2'><TABLE>");

 for( var i=0; i<height_n; i++){

     document.write( "<TR>");

     for( var j=0;j<width_n; j++){

         document.write( "<TD><CENTER><INPUT TYPE='radio'></CENTER></TD>");

     }

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

 }

 document.write( "<TR>");

 for( var j=0;j<width_n; j++){

     document.write( "<TD><INPUT TYPE='button' VALUE='A' onClick='fire("

         + j + ")'></TD>");

 }

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

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

 document.write( "<INPUT TYPE='button' VALUE='START' onClick='game_start()'>");

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

 

 // ----- game main timer event

 // -----     enemy come one step

 function come(){

     var n = poor_rand();

     document.fm2.elements[ width_n * enemy[n+1] + n].checked = true;

     enemy[n+1]++;

     if( enemy[n+1] < height_n){

         setTimeout("come()", wtime);

     }else{

       gameover = true;

       document.fm1.message.value =  "GAME OVER:" + score ;

     }

 }

 

 // ----- Fire the n th beam

 function fire( n){

     if( gameover ) return;

     for( var i=0; i<enemy[n+1]; i++){ // clear enemy

         document.fm2.elements[ width_n * i + n].checked = false;

     }

     score += enemy[ n+1];

     document.fm1.message.value = "Points:" + score;

     enemy[ n+1] = 0;

     if( wtime > 50){ wtime -= 10};

 }

 

 // ---- initialize & start game

 function game_start(){

    for( var n=0; n<width_n; n++){

         for( var i=0; i<enemy[n+1]; i++){

             document.fm2.elements[ width_n * i + n].checked = false;

         }

         enemy[n+1] = 0;

     }

     wtime = 150;

     score = 0;

     gameover = false;

     document.fm1.message.value = "Points:" + score;

     setTimeout("come()", wtime);

 }

 

 // -->

 

 </SCRIPT>

 

 

 

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

<BODY bgcolor="#fef4d9" onLoad="document.forms[0].guess.focus(); document.forms[0].guess.select()">

 

0 Comments

Tue

17

Mar

2009

19、选择路线游戏

19、选择路线游戏

脚本说明:

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

<script>

 var line = "";

 var x = 0;

 var y = 0;

 var full="*";

 var blank = ".";

 var wall = "#";

 var goal = "$";

 

 var fill = "";

 

 // Functions to create the board

 

 function makeboard() {

         for (var i=1; i<= 10; i++)

                 this[i] = new makeRow();

         return this;

 }

 

 function makeRow() {

         for (var i=1; i<= 10; i++)

                 this[i]=blank;

 

         return this;

 }

 

 // Functions to fill & clear the board.

 

 function clearBoard (form) {

 // Clears & resets the board

         x = 0;

 

         y = 0;

 

         form.xval.value = 1;

 

         form.yval.value = 1;

 

         for (var i=1; i<= 10; i++)

                 for (var j=1; j<= 10; j++)

                         theBoard[i][j]=blank;

 

         drawMaze();

         fillBoard(form);

         return;

 }

 

 function fillBoard (form) {

         // Clear board buffer

         line = "";

         form.grid.value = "";

         // Fill board buffer

         for (var i=1; i<= 10; i++)

                 for (var j=1; j<= 10; j++)

                         line += theBoard[i][j];

 

         // Move buffer contents to board

         form.grid.value=line;

 

 }

 

 function plot (v, h) {

         theBoard[v][h] = fill;

 

 }

 

 function drawMaze() {

 // Plots the walls of the maze

 //

 // Ideally, a function should do this automatically,

 // or maybe I should write a maze generating function in JS!

 // Note: This program operates in Y,X co-ordinates (not standard X,Y).

 

         theBoard[10][10] = goal;

 

         theBoard[1][2] = wall;

 

         theBoard[2][2] = wall;

 

         theBoard[4][1] = wall;

 

         theBoard[4][2] = wall;

 

         theBoard[4][3] = wall;

 

         theBoard[2][3] = wall;

 

         theBoard[5][2] = wall;

 

         theBoard[6][2] = wall;

 

         theBoard[2][5] = wall;

 

         theBoard[4][5] = wall;

 

         theBoard[5][5] = wall;

 

         theBoard[2][6] = wall;

 

         theBoard[2][7] = wall;

 

         theBoard[9][10] = wall;

 

         theBoard[9][9] = wall;

 

         theBoard[8][9] = wall;

 

         theBoard[7][9] = wall;

 

         theBoard[10][7] = wall;

 

         theBoard[9][7] = wall;

 

         theBoard[8][7] = wall;

 

         theBoard[6][7] = wall;

 

         theBoard[9][2] = wall;

 

         theBoard[9][3] = wall;

 

         theBoard[9][4] = wall;

 

         theBoard[8][2] = wall;

 

         theBoard[7][4] = wall;

 

         theBoard[7][5] = wall;

 

         theBoard[6][5] = wall;

 

         theBoard[6][6] = wall;

 

theBoard[6][7] = wall;

 

theBoard[6][8] = wall;

 

theBoard[6][9] = wall;

 

         theBoard[5][7] = wall;

 

         theBoard[5][8] = wall;

 

         theBoard[5][9] = wall;

 

         theBoard[4][9] = wall;

 

 }

 

 function update(form) {

         var horiz = eval(form.xval.value);

 

         var vert = eval(form.yval.value);

 

         plot(vert,horiz);

         fillBoard(form);

         return;

 }

 

 function initBoard() {

         theBoard = new makeboard();

         fill = full;

 

         clearBoard(document.board);

         update(document.board);

 }

 

 // Functions to handle the player piece

 //

 // I suppose I could have written one function to handle this,

 // but it was getting too complex.  Feel free to try. :)

 //

 

 function decx(form) {

         fill = blank;

 

         update(form);

         checkx = eval(form.xval.value - 1);

         checky = form.yval.value;

 

         if (form.xval.value > 1) {

                 if (theBoard[checky][checkx] != wall) {

                         form.xval.value=eval(form.xval.value - 1);

                 }

                 else {

                         alert("THUD!\nYou hit a wall.");

                 }

                 if (theBoard[checky][checkx] == goal) {

                         alert("YOU WIN!");

                 }

         }

         fill = full;

         update(form);

 }

 

 function incx(form) {

         fill = blank;

         update(form);

         checkx = eval(1 * form.xval.value + 1);

         checky = form.yval.value;

         if (form.xval.value < 10) {

                 if (theBoard[checky][checkx] != wall) {

                         form.xval.value=eval(1 * form.xval.value + 1);

                 }

                 else {

                         alert("THUD!\nYou hit a wall.");

                 }

                 if (theBoard[checky][checkx] == goal) {

                         alert("YOU WIN!");

                 }

         }

         fill = full;

 

         update(form);

 }

 

 function decy(form) {

         fill = blank;

 

         update(form);

         checkx = form.xval.value;

 

         checky = eval(form.yval.value - 1);

         if (form.yval.value > 1) {

                 if (theBoard[checky][checkx] != wall) {

                         form.yval.value=eval(form.yval.value - 1);

                 }

                 else {

                         alert("THUD!\nYou hit a wall.");

                 }

                 if (theBoard[checky][checkx] == goal) {

                         alert("YOU WIN!");

                 }

         }

         fill = full;

         update(form);

 }

 

 function incy(form) {

         fill = blank;

         update(form);

         checkx = form.xval.value;

         checky = eval(1 * form.yval.value + 1);

         if (form.yval.value < 10) {

                 if (theBoard[checky][checkx] != wall) {

                         form.yval.value=eval(1 * form.yval.value + 1);

                 }

                 else {

                         alert("THUD!\nYou hit a wall.");

                 }

                 if (theBoard[checky][checkx] == goal) {

                         alert("YOU WIN!");

                 }

         }

         fill = full;

 

         update(form);

 }

 

 // Various Functions

 

 function cheater (form) {

 // Refuse to change values manually, and start over. CHEATER!

         alert("You can't change this value manually.\nPlease use the buttons.");

         clearBoard(form);

         update(form);

 }

 

 

 </script>

 

 <form method="post" name="board">

 <input type='button' value='Reset' onClick='clearBoard(this.form);update(document.board);'>

 <br>

 <textarea name="grid" rows="12" cols="10" wrap=virtual&rt;</textarea&rt;<br>

 <!-- virtual-wrap is the key! Now one text line becomes a grid! -->

 <table>

 <tr>

   <td><input type='button' value='UP' onClick='decy(this.form)'></td>

   <td><input type='text' value='1' size=5 name='yval' onChange='cheater(this.form);'></td>

   <td><input type='button' value='DOWN' onClick='incy(this.form)'></td>

 <tr>

   <td><input type='button' value='LEFT' onClick='decx(this.form)'></td>

   <td><input type='text' value='1' size=5 name='xval' onChange='cheater(this.form);'></td>

   <td><input type='button' value='RIGHT' onClick='incx(this.form)'></td>

 </table>

 </form>

 

 

 

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

<BODY bgcolor="#fef4d9" onLoad="timerONE=window.setTimeout('scrollit_r2l(100)',500);initBoard();">

 

0 Comments

Tue

17

Mar

2009

18、测试心算能力

18、测试心算能力

脚本说明:

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

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

 function es() {   

 alert("请先作好准备.")        

 x=0   

 var today=new Date()   

 sec=0   

 for (i=1;i<=5;i++) {            

 sec=today.getSeconds()       

 rand1 = 31       

 while ( rand1 > 30 ) {           

 rand1 = Math.random()*sec*100          

 rand1 = Math.ceil(rand1)       

 }       

 rand2 = Math.random()       

 if (rand2>0.5) {

 mes="加上 ";

 mes1=" ";

 y=rand1

 }                 

 else{

 mes=" 减去 " ;

 mes1=" ";

 y=-rand1

 }   

 x1=x   

 x=x+y   

 if (x<0) {

 mes="加上 ";

 mes1=" ";

 x=x1+rand1

 }   

 alert("请把原来结果"+mes+rand1+mes1+". ")               

 }   

 alert("请仔细想一下最后的结果.")   

 alert("最后结果为 "+x+" , 你算对了吗 ?")

 }

 //-->

 </SCRIPT><FORM NAME="f"><INPUT TYPE="button" VALUE="开始啦" onClick="es()">

 

 

0 Comments

Tue

17

Mar

2009

17、测试打字速度

17、测试打字速度

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

msg = new Array("Practicing with your typing can greatly help your overall computer skills.",

"A new computer is sold in the US every hour!",

"When do birds migrate from North to South?",

"Perplexing phrases, like this one, are tougher to type.")

word = 10

function m() {

msg = new Array("Practicing with your typing can greatly help your overall computer skills.",

"A new computer is sold in the US every hour!",

"When do birds migrate from North to South?",

"Perplexing phrases, like this one, are tough to type.")

word = 10

}

function e() {

msg = new Array("If you can correctly, and quickly, type this perplexing sentence, you are one superb typist!",

"You are one superb typist if you can correctly, and quickly, type this long phrase.",

"I believe you're a good typist, so I believe you will correctly copy this statement!",

"Because this is not a fairly simple phrase, could you swiftly, and precisely, copy it?")

word = 15

}

function s() {

msg = new Array("Computers are the medium of the future.",

"Can you type this phrase rather quickly?",

"Who is the President of the US?",

"I believe that you can type well!")

word = 7

}

function beginIt() {

randNum = Math.floor((Math.random() * 10)) % 4

msgType = msg[randNum]

day = new Date();

startType = day.getTime();

document.theForm.given.value = msgType

document.theForm.typed.focus();

document.theForm.typed.select();

}

function cheat() {

alert("对不起,这里的内容你不能改变!!");

document.theForm.typed.focus();

}

function stopIt() {

dayTwo = new Date();

endType = dayTwo.getTime();

totalTime = ((endType - startType) / 1000)

spd = Math.round((word/totalTime) * 60)

if (document.theForm.typed.value == document.theForm.given.value) {

alert("\n你输入了 " + word + " 个字符,在 "

+ totalTime + " 秒内, 速度为每秒钟 " + spd + " 个字符!")

}

else {

alert("你输入有错,但是你每分钟输入 " + spd + " 个字符.")

   }

}

// End -->

</SCRIPT>

 

 

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

<FORM name="theForm">

<TABLE BORDER=3 CELLSPACING=0 CELLPADDING=0>

<TR>

<TD>你是个...</TD>

<TD align=center><input type=radio name="sme" value="Beginner" onClick="s()" checked>初级者

<input type=radio name="sme" value="Novice" onClick="m()">中级者

<input type=radio name="sme" value="Expert" onClick="e()">高级者</TD>

</TR>

<TR><TD colspan=2><BR>

<center><input type=button value="开始测试" name="start" onClick="beginIt()"></center><P>

<textarea name="given" cols=53 rows=3 wrap=on onFocus="cheat()">

 

0 Comments

Tue

17

Mar

2009

16、一个输赢游戏

16、一个输赢游戏

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function playGame(choice) {

with (document.game) {

comp = Math.round((Math.random() * 2) + 1);

var choicename;

if (comp == 1) choicename = "rock";

if (comp == 2) choicename = "paper";

if (comp == 3) choicename = "scissors";

msg.value = 'The computer chose ' + choicename + ';  ';

 

switch(choice) { // calculates score

case 1 : // rock

         if (comp == 1) {  draw.value++; msg.value += 'It is a draw.'; break; }

         if (comp == 2) {  loss.value++;  msg.value += 'You lost!';     break; }

         if (comp == 3) {  win.value++; msg.value += 'You won!';      break; }

case 2 : // paper

         if (comp == 1) {  win.value++;  msg.value += 'You won!';      break; }

         if (comp == 2) {  draw.value++; msg.value += 'It is a draw.'; break; }

         if (comp == 3) {  loss.value++; msg.value += 'You lost!';     break; }

case 3 : // scissors

         if (comp == 1) {  loss.value++;  msg.value += 'You lost!';     break; }

         if (comp == 2) {  win.value++; msg.value += 'You won!';      break; }

         if (comp == 3) {  draw.value++; msg.value += 'It is a draw.'; break; }

      }

      msg.value += '  Go again!';

   }

}

//  End -->

</script>

 

 

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

<form name=game>

<table border=1 cellpadding=5>

<tr>

<td align=center>User:</td>

<td align=center><a href="javascript:void(0);" onClick="playGame(1);"><img src="rock.gif" width=29 height=23 border=0></a></td>

<td align=center><a href="javascript:void(0);" onClick="playGame(2);"><img src="paper.gif" width=29 height=23 border=0></a></td>

<td align=center><a href="javascript:void(0);" onClick="playGame(3);"><img src="scissors.gif" width=29 height=23 border=0></a></td>

</tr>

<tr>

<td colspan=4 align=center><input type=text name=msg size=45></td>

</tr>

<tr>

<td colspan=4 align=center>

<input type=text name=win readonly value="0" size="2"> Wins 

<input type=text name=loss readonly value="0" size="2"> Losses  

<input type=text name=draw readonly value="0" size="2"> Draws

</td>

</tr>

</table>

</form>

 

0 Comments

Tue

17

Mar

2009

15、模拟太空飞行

15、模拟太空飞行

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

 

<!-- Begin

astropic = "5.jpg"; // location of YOUR astronaut image

var xval = new Array(); // holds star coordinates

var yval = new Array();

no = 100;  // number of stars in the background

speed = 200; // speed

xp = 20 + 100 * Math.random();

yp = 20 + 100 * Math.random();

angle = 3.14 * Math.random(); // astronaut angle

xinc = 3 * Math.sin(angle);

yinc = 3;

ie = (document.all)? 1 : 0;

ns = (document.layers)? 1: 0;

if (ie) {

width = document.body.clientWidth;

height = document.body.clientHeight;

for (var i = 0; i <= no; i++) {

document.write("<div id=\"div" + i+ "\" style=\"color:white;");

document.write("position:absolute;left:100;\">.</div>");

}

document.write("<div id=\"diva\" style=\"position:absolute;\">");

document.write("<img src=" + astropic + " border=\"0\" width=\"65\" height=\"95\"></div>");

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

xval[i] = width * Math.random();

yval[i] = height * Math.random();

document.all["div" + i].style.left = xval[i];

document.all["div" + i].style.top = yval[i];

   }

}

if (ns) {

width = self.innerWidth;

height = self.innerHeight;

for (var i = 0; i <= no; i++) {

document.write("<layer id=\"div" + i+ "\" style=\"color:white;");

document.write("position:absolute;left:100;\">.</layer>");

}

document.write("<layer id=\"diva\" style=\"position:absolute;\">");

document.write("<img src=" + astropic + " border=\"0\" width=\"65\" height=\"95\"></layer>");

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

xval[i] = width * Math.random();

yval[i] = height * Math.random();

document.layers["div" + i].left = xval[i];

document.layers["div" + i].top = yval[i];

   }

}

function star() {

for (i = 0; i <= no; i = i+4) {

xval[i] +=5;

if ((i%20) == 0) xval[i] += 10;

if(xval[i] >= width)  xval[i] = width * Math.random();

if (ie) document.all["div" + i].style.left = xval[i];

if (ns) document.layers["div" + i].left = xval[i];

}

return true;

}

function goangle() {

angle = 3.14 * Math.random();

xinc = 3 * Math.sin(angle);

return true;

}

function space() {

if (ie) {

document.all["diva"].style.left = xp;

document.all["diva"].style.top = yp;

}

if (ns) {

document.layers["diva"].left = xp;

document.layers["diva"].top = yp;

}

xp += xinc;

yp +=yinc;

star();

if ((xp >= (width - 50)) || (xp <= 10))  { goangle();  xinc = (-1) * xinc; }

if ((yp >= (height - 50)) || (yp <= 10)) {  goangle(); yinc = (-1) * yinc; }

setTimeout('space()', speed);

}

//  End -->

</script>

 

 

 

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

<BODY bgcolor="black" onLoad="space()">

 

0 Comments

Tue

17

Mar

2009

14、测试点击速度

14、测试点击速度

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Original:  Tomer Shiran

 

<!-- This script and many more are available free online at -->

<!-- The JavaScript Source!! http://javascript.internet.com -->

 

<!-- Begin

var total = 0

var play = false

function display(element) {

var now = new Date()

if (!play) {

play = true

startTime = now.getTime()}

if (now.getTime() - startTime > 20000) {

element.checked = !element.checked

return

}

 if (element.checked)

total++

else

total--

element.form.num.value = total

}

function restart(form) {

total = 0

play = false

for (var i = 1; i <= 100; ++i) {

 form.elements[i].checked = false

   }

}

// End -->

</SCRIPT>

 

 

 

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

<CENTER>Test your skill.  How many boxes can

you check in 20 seconds?</CENTER>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

document.write("<FORM><CENTER>")

document.write('<INPUT TYPE="text" VALUE="0" ');

document.write('NAME="num" SIZE=10 onFocus="this.blur()"><BR>')

document.write("<HR SIZE=1 WIDTH=40%>")

for (var i = 0; i < 10; ++i) {

for (var j = 0; j < 10; ++j) {

document.write('<INPUT TYPE="checkbox" ');

document.write('onClick="display(this)">')}

document.write("<BR>")}

document.write("<HR SIZE=1 WIDTH=40%>")

document.write('<INPUT TYPE="button" VALUE="restart" ');

document.write('onClick="restart(this.form)">')

document.write("</CENTER></FORM>")

// End -->

</SCRIPT>

 

0 Comments

Tue

17

Mar

2009

13、模拟跳舞游戏

13、模拟跳舞游戏

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var agt=navigator.userAgent.toLowerCase();

if (agt.indexOf("mac") != -1)

var a="\r";

else

var a="\n";

var max=0;

function tlist() {

max=tlist.arguments.length;

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

this[i]=tlist.arguments[i];

}

tl = new tlist(

"   o"+a+

"  /|\\"+a+

" */ \\*        跳舞"+a,

 

"   o_"+a+

"  \<| *"+a+

"  *\>\\         跳舞"+a,

 

"  _o/*"+a+

" * |"+a+

"  / \\         跳舞"+a,

 

" *\o_"+a+

"  /  *"+a+

" \<\\           跳舞"+a,

 

"  _o/*"+a+

" * |"+a+

"  / \\         跳舞"+a,

 

" *\\c/*"+a+

"   )"+a+

"  / \>         跳舞"+a,

 

"     *"+a+

"  \\__/c"+a+

"   \> \\*       跳舞"+a,

 

"   __/"+a+

"    (o_*"+a+

"     \\*       跳舞"+a,

 

"      \\ /"+a+

"       |"+a+

"     */o\\*    跳舞"+a,

 

"       \\_"+a+

"       ("+a+

"     */o\\*    跳舞"+a,

 

"        \<_"+a+

"      __("+a+

"     * o|*    跳舞"+a,

 

"         /_"+a+

"      __("+a+

"     * o|*   跳舞"+a,

 

"         ___"+a+

"      *\/ \>"+a+

"       o|*    跳舞"+a,

 

"        *"+a+

"       o|_/"+a+

"      */  \\   跳舞"+a,

 

"        *"+a+

"      _o|_"+a+

"     *   \>\\   跳舞"+a,

 

"       _o/*"+a+

"      * |"+a+

"       / \\    跳舞"+a,

 

"      *\\o/*"+a+

"        |"+a+

"       / \\    跳舞"+a,

 

"      c/*"+a+

"      \<\\"+a+

"      */\\     跳舞"+a,

 

"      c__"+a+

"      \<\ *"+a+

"      */\\     跳舞"+a,

 

"      c__"+a+

"      /\ *"+a+

"     * /\>     跳舞"+a,

 

"      c/*"+a+

"     /(__"+a+

"    * /       跳舞"+a,

 

"    __o/*"+a+

"    * (__"+a+

"      \<       跳舞"+a,

 

"      __o_"+a+

"     * /  *"+a+

"      \<\\      跳舞"+a,

 

"     *_o_"+a+

"       | *"+a+

"      \< \\     跳舞"+a,

 

"     *_c_*"+a+

"       |"+a+

"       \>\\     跳舞"+a,

 

"     *_c_*"+a+

"       |__"+a+

"       \>      跳舞"+a,

 

"     *_c_*"+a+

"     __|__"+a+

"              跳舞"+a,

 

" "+a+

"     *_c_*"+a+

"     __)__    跳舞"+a,

 

" "+a+

"     *\\c/*"+a+

"     __)__    跳舞"+a

 

);

var x=0;

function tick() {

document.animation.cheerleader.value = " " + a +

tl[x];

x++;

if (x != max)

setTimeout("tick()", 200);

else

x = 0;

}

//  End -->

</script>

<form name=animation>

<textarea name=cheerleader rows=5 cols=20&rt;</textarea&rt;

<br>

<input type=button value="Start Again" onClick = "javascript:tick()">

</form>

 

 

 

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

<BODY bgcolor="#fef4d9" OnLoad="tick()">

 

1 Comments

Tue

17

Mar

2009

12、动脑小游戏

12、动脑小游戏

脚本说明:

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

<script>

function ShowMenu(bMenu) {

document.all.idFinder.style.display = (bMenu) ? "none" : "block"

document.all.idMenu.style.display = (bMenu) ? "block" : "none"

idML.className = (bMenu) ? "cOn" : "cOff"

idRL.className = (bMenu) ? "cOff" : "cOn"

return false

}

</script>

 

<style>

<!--

A.cOn {text-decoration:none;font-weight:bolder}

#article {font: 12pt Verdana, geneva, arial, sans-serif;  background: white; color: black; padding: 10pt 15pt 0 5pt}

#article P.start {text-indent: 0pt}

#article P {margin-top:0pt;font-size:10pt;text-indent:12pt}

#article #author {margin-bottom:5pt;text-indent:0pt;font-style: italic}

#pageList P {padding-top:10pt}

#article H3 {font-weight:bold}

#article DL, UL, OL {font-size: 10pt}

-->

</style>

<script>

<!--

function addList(url,desc) {

if ((navigator.appName=="Netscape") || (parseInt(navigator.appVersion)>=4)) {

var w=window.open("","_IDHTML_LIST_","top=0,left=0,width=475,height=150,history=no,menubar=no,status=no,resizable=no")

var d=w.document

if (!w._init) {

d.open()

d.write("<TITLE>Loading...</TITLE><EM>Loading...</EM>")

d.close()

d.location.replace("/assist/listing.asp?url="+escape(url)+"&desc="+escape(desc)) 

w.opener=self   

window.status="Personal Assistant (Adding): " + desc

} else {

window.status=w.addOption(url,desc)   

w.focus()

}

}

else

alert("Your browser does not support the personal assistant.")

return false

}

// -->

</script>

 

<style>

    #board {cursor: default}   

    #board TD {width: 25px; height: 25px; }

  </style>

 

 

 

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

<script>

    var size=10

    var moves = 0

    var off = size*2

    var on = 0

    var current = null

    function doOver() {

      if ((event.srcElement.tagName=="TD") && (current!=event.srcElement)) {

        if (current!=null)

          current.style.backgroundColor = current._background

        event.srcElement._background = event.srcElement.style.backgroundColor

        event.srcElement.style.backgroundColor = "lightgrey"

        current = event.srcElement

      }

    }

 

    function setColor(el) {

      if ((el._background=="") || (el._background==null)) {

        el.style.backgroundColor = "yellow"

        el._background = "yellow"

      } else {

        el.style.backgroundColor = ""

        el._background = ""

      }

    }

 

    function countLights() {

      off = 0; on = 0

      for (var x=0; x < size; x++)

        for (var y=0; y < size; y++) {

          var p = board.rows[x].cells[y]

          if (p._background=="yellow")

            on++

          else

            off ++

        }

        document.all.on.innerText = on

      if (off!=0)    

        document.all.off.innerText = off

      else

        document.all.off.innerText = "You Win!"

      return (off==0)

    }

 

    function doClick() {

      setColor(current)    

      var cellIdx = current.cellIndex

      var rowIdx = current.parentElement.rowIndex

      if (rowIdx>0)

        setColor(board.rows[rowIdx-1].cells[cellIdx])

      if (rowIdx<size-1)

        setColor(board.rows[rowIdx+1].cells[cellIdx])

      if (cellIdx>0)

        setColor(board.rows[rowIdx].cells[cellIdx-1])

      if (cellIdx<size-1)

        setColor(board.rows[rowIdx].cells[cellIdx+1])

      moves++

      document.all.moves.innerText = moves

      win = countLights()

      if (win) {

        board.onclick = null

        board.onmouseover = null

        current.style.background = "yellow"

      }

    }

 

    function buildBoard() {

      var str = "<TABLE ID=board ONSELECTSTART=\"return false\" ONCLICK=\"doClick()\" ONMOUSEOVER=\"doOver()\" cellspacing=0 cellpadding=0 border=5>"

      for (var x=0; x < size; x++) {

        str+="<TR>"

        for (var y=0; y < size; y++) {

          str+="<TD> </TD>"

        }

        str+="</TR>"

      }

      str+="</TABLE>"

      return str

    }

 

    function newGame() {

      size = document.all.gameSize.value

      if (size<3)

        size=3

      if (size>15)

        size=15

      document.all.gameSize.value = size

      document.all.board.outerHTML = buildBoard()

      moves=0

      document.all.moves.innerText = moves

      countLights()

 

    }

   

  </script>

  <p align="center"><big><font color="#0000FF">在方格上点击,你可以将下面的方格全部填成黄色吗</font><strong><font

color="#FF0000"><big><big></big></big></font></strong></big></p>

 

<p align="center"><font color="#0000FF">快开动你智慧脑筋,看看有什么技巧与规律。</font></p>

 

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

  <tr>

    <td width="50%"><div align="right"><table ID="score" border="0" width="284">

      <tr>

        <td width="52">移动: </td>

        <td id="moves" width="33">0</td>

        <td width="42">灯灭:</td>

        <td id="off" width="36">25</td>

        <td width="46">灯亮:</td>

        <td id="on" width="39">0</td>

      </tr>

    </table>

    </div></td>

    <td width="50%"><div align="left"><table width="204">

      <tr>

        <td width="54">大小: </td>

        <td width="41"><input ID="gameSize" TYPE="text" VALUE="10" SIZE="2"></td>

        <td width="97"><input ONCLICK="newGame()" TYPE="button" VALUE="开始游戏"></td>

      </tr>

    </table>

    </div></td>

  </tr>

</table>

 

<p align="center"><script>

    document.write(buildBoard())

  </script></p>

 

 

0 Comments

Tue

17

Mar

2009

11、双人小游戏

11、双人小游戏

脚本说明:

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

<script>

function ShowMenu(bMenu) {

document.all.idFinder.style.display = (bMenu) ? "none" : "block"

document.all.idMenu.style.display = (bMenu) ? "block" : "none"

idML.className = (bMenu) ? "cOn" : "cOff"

idRL.className = (bMenu) ? "cOff" : "cOn"

return false

}

</script>

<style>

<!--

A.cOn {text-decoration:none;font-weight:bolder}

#article {font: 12pt Verdana, geneva, arial, sans-serif;  background: white; color: black; padding: 10pt 15pt 0 5pt}

#article P.start {text-indent: 0pt}

#article P {margin-top:0pt;font-size:10pt;text-indent:12pt}

#article #author {margin-bottom:5pt;text-indent:0pt;font-style: italic}

#pageList P {padding-top:10pt}

#article H3 {font-weight:bold}

#article DL, UL, OL {font-size: 10pt}

-->

</style>

<script>

<!--

function addList(url,desc) {

if ((navigator.appName=="Netscape") || (parseInt(navigator.appVersion)>=4)) {

var w=window.open("","_IDHTML_LIST_","top=0,left=0,width=475,height=150,history=no,menubar=no,status=no,resizable=no")

var d=w.document

if (!w._init) {

d.open()

d.write("<TITLE>Loading...</TITLE><EM>Loading...</EM>")

d.close()

d.location.replace("/assist/listing.asp?url="+escape(url)+"&desc="+escape(desc)) 

w.opener=self   

window.status="Personal Assistant (Adding): " + desc

} else {

window.status=w.addOption(url,desc)   

w.focus()

}

}

else

alert("Your browser does not support the personal assistant.")

return false

}

// -->

</script>

 

<style>

#board {font-family: arial}

.dot {position: absolute; width: 5px; height: 5px; font-size: 0pt; background: black}

#line {position: absolute; font-size: 0pt; height: 5px}

.p1 {position: absolute; font-size: 0pt;background: navy}

.p2 {position: absolute; font-size: 0pt;  background: red}

.p1B {position: absolute; font-size: 8pt; color: navy;text-align: center; font-weight: bold}

.p2B {position: absolute; font-size: 8pt; color: red; text-align: center; font-weight: bold}

</style>

<style type="text/css">

<!--

body {  font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}

A { COLOR: black; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: none }

 A:hover { COLOR: red; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: underline }

a:active     { font: 9pt "宋体"; cursor: hand; color: #FF0033 }

 

-->

</style>

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var timerRunning = false;

var timezone = "Greenwich Mean Time";

var adjust = 0;

 

function timeCheck(tzone, diff) {

if (timerRunning) {

clearTimeout(updatetime);

timerRunning = false; }

gmtOffset=eval(diff+adjust);

timezone = tzone;

checkDateTime();

}

 

function checkDateTime () {

var today = new Date();

var year = today.getYear() + 1900;

var month = today.getMonth()+1;

var date = today.getDate();

var day = today.getDay();

var hour = today.getHours();

var minute = today.getMinutes();

var second = today.getSeconds();

 

var lastSat = date - (day+1);

while (lastSat < 32) lastSat+=7;

if (lastSat > 31) lastSat+=-7;

var firstSat = date - (day+1);

while (firstSat > 0) firstSat+=-7;

if (firstSat < 1) firstSat+=7;

if ((((month == 4) && (date >= firstSat)) || month > 4) &&

(month < 11 || ((month == 10) && day <= lastSat))) adjust += 60;

yourOffset = (new Date()).getTimezoneOffset();

yourOffset = yourOffset + adjust;

 

var xx = navigator.appName

var xy = navigator.appVersion;

xy = xy.substring(0,1);

if ((xy == 4) && (xx == "Netscape")) yourOffset = yourOffset+adjust;

if ((((month == 4) && (date > 20)) || month > 4) && (month < 11 || ((month == 10) &&

day < 30))) adjust -= 60;

 

ourDifference = eval(gmtOffset - yourOffset);

var half = eval(ourDifference % 60);

ourDifference = Math.round(ourDifference / 60);

hour = eval(hour - ourDifference);

var m = new Array("",

"Jan","Feb","Mar",

"Apr","May","Jun",

"Jul","Aug","Sept",

"Oct","Nov","Dec");

var leap = eval(year % 4);

 

if ((half == -30) || (half == 30)) minute += 30;

if (minute > 59) minute -= 60, hour++;

if (minute < 0) minute += 60, hour--;

if (hour > 23) hour -= 24, date += 1;

if (((month == 4) || (month == 6) ||

(month == 9) || (month == 11)) && (date==31)) date = 1, month ++;

if (((month == 2) && (date > 28)) && (leap != 0)) date = 1, month ++;

if ((month == 2) && (date > 29)) date = 1, month++;

if (hour < 0) hour += 24, date --;

if ((date == 32) && (month == 12)) month = m[1], date = 1, year++;

if (date == 32) date = 1, month++;

if ((date < 1) && (month == 1)) month= m[12], date = 31, year--;

if (date < 1) date = 31, month --;

if (((month == 4) || (month == 6) ||

(month== 9) || (month == 11)) && (date == 31)) date = 30;

if ((month == 2) && (date > 28)) date = 29;

if (((month == 2) && (date > 28)) && (leap != 0)) date=28;

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

if (month == i) {

month = m[i]; break;

   }

}

 

var dateTime = hour;

dateTime = ((dateTime < 10) ? "0":"") + dateTime;

dateTime = "   " + dateTime;

dateTime += ((minute < 10) ? ":0" : ":") + minute;

dateTime += ((second < 10) ? ":0" : ":") + second;

dateTime += (hour >= 12) ? " PM, " : " AM, ";

dateTime += month + " " + date + ", " + year;

 

document.clock.zonetime.value = dateTime;

document.clock.zonename.value = timezone;

updatetime=setTimeout("checkDateTime()", 900);

timerRunning = true;

}

// End -->

</SCRIPT>

 

 

 

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

<table CELLPADDING="0" CELLSPACING="0" BORDER="0" width="509">

  <tr>

    <td WIDTH="10"></td>

    <td valign="top" WIDTH="499" ID="article"><p class="start" STYLE="text-align: left"><font

    size="+2" style="font-weight:bold;font-size: 14pt"><b>看谁围的框子多?</b></font></p>

    <p>这是一个双人游戏,蓝色的先行,看谁围的框子多,谁就赢。</p>

    <p STYLE="margin-top: 5pt"><script>

  /* DHTML Dots is copyright 1998 insideDHTML.com, LLC. All rights reserved.

     DHTML Dots cannot be reproduced in any manner without prior consent from insideDHTML.com */

 

  var scale= 25

  var size = 5

 

  var totalSize = ((size+1)*scale) + 6

  var cache = new Object()

  var move=0,point=0

  var player = true

 

  function initCache() {

    cache.x = 0

    cache.y = 0

    cache.red = 0

    cache.navy = 0

    move=0,point=0   

  }

 

  function updateScore() {

    document.all.red.innerText = cache.red

    document.all.navy.innerText = cache.navy

    if ((cache.red+cache.navy)==((size-1)*(size-1))) {

      board.onclick = null

      document.all.message.innerText = "Game Over!"

    }

    

  }

 

  function fillPos(x,y) {

    document.all.board.insertAdjacentHTML("beforeEnd","<DIV class=" + (player ? "p1B" : "p2B") + " ID=\"point"+point+"\">" + (player ? "N" : "R") + "</DIV>")

    var el = document.all["point"+point].style

    el.pixelTop = (y*scale)+5

    el.pixelLeft = (x*scale)+5

    el.pixelWidth = scale - 5

    el.pixelHeight = scale - 5

 

  }

 

  function checkBoard(x,y,dir, player) {

    var piece=0

    if ("vertical"==dir) {

      if ((x==size) || (x>1)) {

        var bPos = boardArray[x-1][y]

        var nextV = boardArray[x-1][y+1]

        if ((bPos["vertical"]) && (bPos["horizontal"]) && (nextV["horizontal"])) {

          point++

          piece++

          fillPos(x-1,y)

        }

      }

      if ((x==1) || (x<size)) {

          var nextV = boardArray[x+1][y]

          var nextH = boardArray[x][y+1]

          if ((nextV["vertical"]) && (nextH["horizontal"]) && (boardArray[x][y]["horizontal"])) {

            point++

            piece++

            fillPos(x,y)

          }

      }  

    }   

    else {

      if ((y==size) || (y>1)) {

        var nextV = boardArray[x+1][y-1]

        var bPos = boardArray[x][y-1]

        if ((bPos["vertical"]) && (bPos["horizontal"]) && (nextV["vertical"])) {

          point++

          piece++

          fillPos(x,y-1)

        }

      }

      if ((y==1) || (y<size)) {

        var nextV = boardArray[x+1][y]

        var nextH = boardArray[x][y+1]

        if ((nextV["vertical"]) && (nextH["horizontal"]) && (boardArray[x][y]["vertical"])) {

          point++

          piece++

          fillPos(x,y)

        }

      }

    }

    if (piece>0) {

      if (player)

       cache.navy+=piece

      else

       cache.red+=piece

      document.all.message.innerText = "Score! Go Again."

      updateScore()

      return player

    }

    else

      return !player

       

  }

 

  function doMouseMove() {

    if (event.srcElement.className!="dot") {

      var x = Math.floor(event.offsetX / scale)

      var y = Math.floor(event.offsetY / scale)

      var dirX = (event.offsetX % scale)

      var dirY = (event.offsetY % scale)

      if ((x<size+1) && (y<size+1) && (y>0) && (x>0)) {

        if (dirX>=dirY) {

          if (x<size) {

            line.style.pixelHeight = 5

            line.style.pixelWidth = scale  - 5

            line.style.pixelTop = (y * scale)

            line.style.pixelLeft = (x * scale) + 5

            cache.direction = "horizontal"

          }

        } else

        {

          if (y<size) {

            line.style.pixelWidth = 5

            line.style.pixelHeight = scale - 5

            line.style.pixelTop = (y * scale) + 5

            line.style.pixelLeft = x * scale

            cache.direction = "vertical"

          }

        }

        cache.x = x

        cache.y = y

      }

    }

   

  }

 

  function doClick() {

 

    if (cache.x==0) return

    if (boardArray[cache.x][cache.y][cache.direction])

      document.all.message.innerText="That spot is taken! Choose again"

    else {

      document.all.board.insertAdjacentHTML("beforeEnd","<DIV class=" + (player ? "p1" : "p2") + " ID=move"+move+"></DIV>")

      var el = document.all["move"+move]

      el.style.top = line.style.top

      el.style.left = line.style.left

      el.style.width = line.style.width

      el.style.height = line.style.height

      boardArray[cache.x][cache.y][cache.direction]=true

      var nextPlayer = checkBoard(cache.x,cache.y,cache.direction, player)

      if (nextPlayer!=player) {

        player = nextPlayer

        if (player) {

          document.all.message.innerText = "Navy players turn"

          line.style.border = "1px navy solid"

        }

        else {

          document.all.message.innerText = "Red players turn"

          line.style.border = "1px red solid"

        }

      }

    }

 

 

    move++

  }

 

  function buildDiv(x,y, scale) {

    return ("<DIV CLASS=dot STYLE=\"top:" +  (x*scale) + "; left: " + (y*scale) + "\"></DIV>")

  }  

 

  var boardArray = new Object

 

 

  function buildBoard() {

    initCache()

    board = ("<DIV ID=line STYLE=\"border: 1px navy solid; width: 0; height: 0\"></DIV>")

    boardArray = new Object()

    for (var x=1; x < size+1; x++) {

      boardArray[x] = new Object()

      for (var y=1; y < size+1; y++) {

        boardArray[x][y] = new Object

        boardArray[x][y]["vertical"] = false

        boardArray[x][y]["horizontal"] = false

        board+=(buildDiv(x,y, scale))

      }

    }

 

    return board

  }

 

  function createGame() {

    size=parseInt(document.all.setSize.value)

    if (size>12)

      size=12

    if (size<3)

      size=3

    document.all.setSize.value = size

    document.all.board.innerHTML = buildBoard()

    document.all.board.onclick = doClick

    totalSize = ((size+1)*scale) + 6

    document.all.board.style.pixelWidth = totalSize

    document.all.board.style.pixelHeight = totalSize

    document.all.message.innerText = "Navy player goes first. Good Luck!"

    updateScore()   

  }

  document.write("<DIV ID=board STYLE=\"position: relative; height: "+ totalSize + "; width:" + totalSize + "; border: 1px black solid\">" + buildBoard() + "</DIV>")

  document.all.board.onmousemove = doMouseMove

  document.all.board.onclick = doClick

 

</script> </p>

    <div STYLE="margin-left: 10pt; margin-top: 5pt"><p class="start" ID="message">Navy player

    goes first. Good Luck!</p>

    <dd><br>

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

        <tr>

          <td style="color: red"><b>Red</b></td>

          <td ID="red">0</td>

        </tr>

        <tr>

          <td style="color: navy"><b>Navy</b></td>

          <td ID="navy">0</td>

        </tr>

      </table>

      <p><br>

      </p>

      <table width="200">

        <tr>

          <td>游戏大小: </td>

          <td><input TYPE="Text" VALUE="5" ID="setSize" SIZE="2"></td>

        </tr>

        <tr>

          <td COLSPAN="2" align="center"><input TYPE="button" ONCLICK="createGame()"

          VALUE="New Game"></td>

        </tr>

      </table> <p CLASS="copyright"> </p>

    </dd>

    </div></td>

  </tr>

</table>

 

0 Comments

Tue

17

Mar

2009

10、一款流行游戏

10、一款流行游戏

脚本说明:

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

<form name="open-pong">

<input type=button value="打开游戏" onClick="window.open('pong.htm','pong','top=100,left=100,width=575,height=400');">

</form>

 

 

 

第二步:把如下代码另存为pong.htm,you1.htm放在同一目录中

<HEAD>

 

<SCRIPT LANGUAGE="JavaScript">

<!-- Original:  Nick Young (ywing9787@aol.com) -->

<!-- Web Site:  http://www.angelfire.com/biz6/ywing9787 -->

 

<!-- This script and many more are available free online at -->

<!-- The JavaScript Source!! http://javascript.internet.com -->

 

<!-- Begin

var timerID = null;

var INT = 10;

var loadFLG = 0;

var gameFLG = 0;

var missFLG = 0;

var tim = 0;

var blcol = new Array(5); // block color

var blsta = new Array(40); // block status

var blNO = new Array(40); // block No

var blclr = 0; // clear block

var ballX = 0; // ball data

var ballY = 0;

var ballN = 5;

var ballDX = 0;

var ballDY = 0;

var tmpRL = 193;

var X = 0;

blcol[0] = "#FFFF00";

blcol[1] = "#FFCF00";

blcol[2] = "#FF7F00";

blcol[3] = "#FF3F00";

blcol[4] = "#FF0000";

blcol[5] = "#000000";

 

function mainF() {

clearTimeout(timerID);

tim = tim + 1;

with (Math){ tmptim = floor(tim / 10)};

document.forms[0].TM.value = tmptim;

ballX = ballX + ballDX;

ballY = ballY + ballDY;

outCHK();

blkCHK();

ball.style.posTop = ballY;

ball.style.posLeft = ballX;

racket.style.posLeft = tmpRL;

if (gameFLG == 01){

timerID = setTimeout("mainF()", INT);

   }

}

function initG() {

if (blclr >= 40) {

blclr = 0;

tim = 0;

ballN = 3;

with (Math) {

tmptim = floor(tim / 10);

}

document.forms[0].TM.value = tmptim;

clrmes.style.posTop = -1000;

clrmes.style.posLeft = -1000;

ovrmes.style.posTop = -1000;

ovrmes.style.posLeft = -1000;

for (ib = 0; ib < 5; ib++){ for (ia = 0; ia < 8; ia++) {

chc(ib * 8 + ia +1, ib);

blsta[ib * 8 + ia] = ib;

      }

   }

}

document.forms[0].BL.value = ballN;

starter.style.posTop = -1000;

starter.style.posLeft = -1000;

gameFLG = 1;

loadFLG = 1;

ballX = 209;

ballY = 270;

ballDX =- 8;

ballDY =- 8;

tmpRL = 193;

missFLG = 0;

timerID = setTimeout("mainF()", INT);

}

function SUP() {

UP.outerHTML = "<DIV ID='DN' STYLE='position:absolute'><A HREF='javascript:SDN()'>SPEED DOWN</A></DIV>";

DN.style.posTop = 170;

DN.style.posLeft = 432;

INT = 10;

}

function SDN() {

DN.outerHTML = "<DIV ID='UP' STYLE='position:absolute'><A HREF='javascript:SUP()'>SPEED UP</A></DIV>";

UP.style.posTop = 170;

UP.style.posLeft = 432;

INT = 100;

}

function MouseMv() {

if (loadFLG == 1) {

tmpRL = X - 20;

if (tmpRL < 16) { tmpRL = 16; }

if (tmpRL > 370) { tmpRL = 370; }

   }

}

function outCHK() {

if (ballX < 16){ ballX = 32 - ballX; ballDX = -ballDX; }

if (ballX > 401){ ballX = 802 - ballX; ballDX = -ballDX; }

if (ballY < 16){ ballY = 32 - ballY; ballDY = -ballDY; }

if (ballY >= 272) {

if (missFLG == 0) {

tmpX = (ballDX / ballDY) * (272 - ballY) + ballX;

if (tmpX >= tmpRL - 12) {

if (tmpX <= tmpRL + 42) {

ballY = 272; ballDY = -ballDY;

ballX = tmpX;

ballRD = tmpX - tmpRL;

with (Math){ ballDX = 8 * abs(ballDX) / ballDX; }

if (ballRD < -4){ ballDX = -15; }

if (ballRD > 36){ ballDX = 15; }

if (ballRD >= 14){ if (ballRD <= 16) { ballDX = -2; } }

if (ballRD >= 17){ if (ballRD <= 20) { ballDX = 2; } }

if (ballRD >= 0){ if (ballRD <= 4) { ballDX = -4; } }

if (ballRD >= 28){ if (ballRD <= 32) { ballDX = 4; } }

if (ballRD >= -4){ if (ballRD <= -1) { ballDX = -11; } }

if (ballRD >= 33){ if (ballRD <= 36) { ballDX = 11; } }

   }

}

if (ballDY > 0){ missFLG = 1; }

} else {

if (ballY > 290){ missFLG = 0; ballN = ballN - 1; gameEnd(); }

      }

   }

}

function blkCHK() {

tmpY = ballY + 4;

tmpX = ballX + 4;

if (tmpY >= 48) {

if (tmpY <= 147) {

if (tmpX >= 29) {

if (tmpX <= 396) {

with (Math) {

ia = floor((tmpX - 29) / 46);

ib = floor((tmpY - 48) / 20);

ic = ib * 8 + ia;

}

if (blsta[ic] <= 4) {

tmpbc = blsta[ic] + 1;

blsta[ic] = tmpbc;

chc(ic + 1, tmpbc);

if (tmpbc == 5){ blclr = blclr + 1; }

if (blclr >= 40){ gameEnd(); }

if (ballDX > 0) {

iy=(ballDY / ballDX) * (29 + 46 * ia - tmpX) + tmpY;

if (iy > 48 + 20 * ib + 18) {

tmpY1 = 48 + 20 * ib + 18;

tmpX1 = (ballDX / ballDY) * (48 + 20 * ib + 18 - tmpY) + tmpX;

ballX = tmpX1 - 4;

ballY = tmpY1 - 4;

ballDY = -ballDY;

} else {

if (iy < 44 + 20 * ib) {

tmpY1 = 48 + 20 * ib;

tmpX1 = (ballDX / ballDY) * (48 + 20 * ib - tmpY) + tmpX;

ballX = tmpX1 - 4;

ballY = tmpY1 - 4;

ballDY = -ballDY;

} else {

tmpX1 = 29 + 46 * ia;

tmpY1 = (ballDY / ballDX) * (29 + 46 * ia - tmpX) + tmpY;

ballX = tmpX1 - 4;

ballY = tmpY1 - 4;

ballDX = -ballDX;

      }

   }

} else {

iy = (ballDY / ballDX) * (29+46 * ia + 44 - tmpX) + tmpY;

if (iy > 48 + 20 * ib + 18) {

tmpY1 = 48 + 20 * ib + 18;

tmpX1 = (ballDX / ballDY) * (48 + 20 * ib + 18 - tmpY) + tmpX;

ballX = tmpX1 - 4;

ballY = tmpY1 - 4;

ballDY = -ballDY;

} else {

if (iy < 44 + 20 * ib) {

tmpY1 = 48 + 20 * ib;

tmpX1 = (ballDX / ballDY) * (48 + 20 * ib - tmpY) + tmpX;

ballX = tmpX1 - 4;

ballY = tmpY1 - 4;

ballDY = -ballDY;

} else {

tmpX1 = 29+46 * ia + 44;

tmpY1 = (ballDY / ballDX) * (29 + 46 * ia + 44 - tmpX) + tmpY;

ballX = tmpX1 - 4;

ballY = tmpY1 - 4;

ballDX = -ballDX;

      }

   }

}

      }

   }

}

      }

   }

}

function gameEnd() {

document.forms[0].BL.value = ballN;

gameFLG = 0;

loadFLG = 0;

starter.style.posTop  =  200;

starter.style.posLeft  =  180;

if (blclr >= 40) {

clrmes.style.posTop = 150;

clrmes.style.posLeft = 160;

}

if (ballN <= 0) {

ovrmes.style.posTop = 150;

ovrmes.style.posLeft = 160;

blclr = 40;

   }

}

function onLD() {

bgIE.style.posTop = 16;

bgIE.style.posLeft = 16;

ball.style.posTop = 270;

ball.style.posLeft = 209;

racket.style.posTop = 280;

racket.style.posLeft = 193;

info.style.posTop = 16;

info.style.posLeft = 432;

starter.style.posTop = -1000;

starter.style.posLeft = -1000;

clrmes.style.posTop = -1000;

clrmes.style.posLeft = -1000;

ovrmes.style.posTop = -1000;

ovrmes.style.posLeft = -1000;

DN.style.posTop = 170;

DN.style.posLeft = 432;

for (ib = 0; ib < 5; ib++) {

for (ia = 0; ia < 8; ia++) {

blsta[ib * 8 + ia] = ib;

   }

}

starter.style.posTop = 200;

starter.style.posLeft = 180;

}

function chc(bno,bcl) {

tmpbno = ((bno < 10) ? "b0" : "b") + (bno-1);

eval(tmpbno).bgColor = blcol[bcl];

}

//  End -->

</script>

</HEAD>

<body onLoad="onLD();" onMouseMove='X=event.x;MouseMv();'>

<span id=info style='position:absolute'>

<pre>

<font style="font-size:24px" color="#000044"><i><b>PONG</b></i></font>

<form>

Ball: <input type=text name=BL size=5 value=5>

Time: <input type=text name=TM size=5 value=0>

</form>

</pre>

</span>

 

<SCRIPT LANGUAGE="JavaScript">

<!--  block image write

with (document) {

write("<table id='bgIE' width='394' height='300' bgcolor='#000000' style='position:absolute'><td></td></table>");

 

write("<table id='b00' width='42' height='16' bgcolor='#FFFF00' style='position:absolute; top:48; left:29'><td></td></table>");

write("<table id='b01' width='42' height='16' bgcolor='#FFFF00' style='position:absolute; top:48; left:75'><td></td></table>");

write("<table id='b02' width='42' height='16' bgcolor='#FFFF00' style='position:absolute; top:48; left:121'><td></td></table>");

write("<table id='b03' width='42' height='16' bgcolor='#FFFF00' style='position:absolute; top:48; left:167'><td></td></table>");

write("<table id='b04' width='42' height='16' bgcolor='#FFFF00' style='position:absolute; top:48; left:213'><td></td></table>");

write("<table id='b05' width='42' height='16' bgcolor='#FFFF00' style='position:absolute; top:48; left:259'><td></td></table>");

write("<table id='b06' width='42' height='16' bgcolor='#FFFF00' style='position:absolute; top:48; left:305'><td></td></table>");

write("<table id='b07' width='42' height='16' bgcolor='#FFFF00' style='position:absolute; top:48; left:351'><td></td></table>");

 

write("<table id='b08' width='42' height='16' bgcolor='#FFCF00' style='position:absolute; top:68; left:29'><td></td></table>");

write("<table id='b09' width='42' height='16' bgcolor='#FFCF00' style='position:absolute; top:68; left:75'><td></td></table>");

write("<table id='b10' width='42' height='16' bgcolor='#FFCF00' style='position:absolute; top:68; left:121'><td></td></table>");

write("<table id='b11' width='42' height='16' bgcolor='#FFCF00' style='position:absolute; top:68; left:167'><td></td></table>");

write("<table id='b12' width='42' height='16' bgcolor='#FFCF00' style='position:absolute; top:68; left:213'><td></td></table>");

write("<table id='b13' width='42' height='16' bgcolor='#FFCF00' style='position:absolute; top:68; left:259'><td></td></table>");

write("<table id='b14' width='42' height='16' bgcolor='#FFCF00' style='position:absolute; top:68; left:305'><td></td></table>");

write("<table id='b15' width='42' height='16' bgcolor='#FFCF00' style='position:absolute; top:68; left:351'><td></td></table>");

 

write("<table id='b16' width='42' height='16' bgcolor='#FF7F00' style='position:absolute; top:88; left:29'><td></td></table>");

write("<table id='b17' width='42' height='16' bgcolor='#FF7F00' style='position:absolute; top:88; left:75'><td></td></table>");

write("<table id='b18' width='42' height='16' bgcolor='#FF7F00' style='position:absolute; top:88; left:121'><td></td></table>");

write("<table id='b19' width='42' height='16' bgcolor='#FF7F00' style='position:absolute; top:88; left:167'><td></td></table>");

write("<table id='b20' width='42' height='16' bgcolor='#FF7F00' style='position:absolute; top:88; left:213'><td></td></table>");

write("<table id='b21' width='42' height='16' bgcolor='#FF7F00' style='position:absolute; top:88; left:259'><td></td></table>");

write("<table id='b22' width='42' height='16' bgcolor='#FF7F00' style='position:absolute; top:88; left:305'><td></td></table>");

write("<table id='b23' width='42' height='16' bgcolor='#FF7F00' style='position:absolute; top:88; left:351'><td></td></table>");

 

write("<table id='b24' width='42' height='16' bgcolor='#FF3F00' style='position:absolute; top:108; left:29'><td></td></table>");

write("<table id='b25' width='42' height='16' bgcolor='#FF3F00' style='position:absolute; top:108; left:75'><td></td></table>");

write("<table id='b26' width='42' height='16' bgcolor='#FF3F00' style='position:absolute; top:108; left:121'><td></td></table>");

write("<table id='b27' width='42' height='16' bgcolor='#FF3F00' style='position:absolute; top:108; left:167'><td></td></table>");

write("<table id='b28' width='42' height='16' bgcolor='#FF3F00' style='position:absolute; top:108; left:213'><td></td></table>");

write("<table id='b29' width='42' height='16' bgcolor='#FF3F00' style='position:absolute; top:108; left:259'><td></td></table>");

write("<table id='b30' width='42' height='16' bgcolor='#FF3F00' style='position:absolute; top:108; left:305'><td></td></table>");

write("<table id='b31' width='42' height='16' bgcolor='#FF3F00' style='position:absolute; top:108; left:351'><td></td></table>");

 

write("<table id='b32' width='42' height='16' bgcolor='#FF0000' style='position:absolute; top:128; left:29'><td></td></table>");

write("<table id='b33' width='42' height='16' bgcolor='#FF0000' style='position:absolute; top:128; left:75'><td></td></table>");

write("<table id='b34' width='42' height='16' bgcolor='#FF0000' style='position:absolute; top:128; left:121'><td></td></table>");

write("<table id='b35' width='42' height='16' bgcolor='#FF0000' style='position:absolute; top:128; left:167'><td></td></table>");

write("<table id='b36' width='42' height='16' bgcolor='#FF0000' style='position:absolute; top:128; left:213'><td></td></table>");

write("<table id='b37' width='42' height='16' bgcolor='#FF0000' style='position:absolute; top:128; left:259'><td></td></table>");

write("<table id='b38' width='42' height='16' bgcolor='#FF0000' style='position:absolute; top:128; left:305'><td></td></table>");

write("<table id='b39' width='42' height='16' bgcolor='#FF0000' style='position:absolute; top:128; left:351'><td></td></table>");

 

write("<div id='ball' style='position:absolute'>");

write("<table width='4' height='8' bgcolor='#B0B0B0' style='position:absolute; left:0; top:0'><td></td></table>");

write("<table width='8' height='4' bgcolor='#B0B0B0' style='position:absolute; left:-1; top:2'><td></td></table>");

write("<table width='4' height='4' bgcolor='#FFFFFF' style='position:absolute; left:0; top:1'><td></td></table>");

write("</div>");

write("<table id='racket' width='40' height='4' bgcolor='#B0B0FF' style='position:absolute'><td></td></table>");

write("<div id='starter' style='position:absolute'><form><input type='button' value='START' ONCLICK='initG();blur()'></form></div>");

write("<div id='clrmes'  style='position:absolute'><font style='font-size:24px' color='#44CC44'>ALL CLEAR!</font></div>");

write("<div id='ovrmes' style='position:absolute'><font style='font-size:24px' color='#CC4444'>GAME OVER!</font></div>");

write("<div id='DN' style='position:absolute'><a href='javascript:SDN()'>SPEED DOWN</a></div>");

}

// End -->

</script>

 

0 Comments

Tue

17

Mar

2009

9、在线测试四8

9、在线测试四8

<!-- 要实现此效果需要 3 个步骤: -->

 

<!-- 1 步: -->

<!-- 把下面的代码加到<HEAD></HEAD>区域中: -->

 

<SCRIPT LANGUAGE="JavaScript">

var js_mult1=3141

var js_mult2=5821

var js_m1=100000000

var js_m2=10000

var js_iseed=0

var js_iseed1=0

var js_iseed2=0

function random(n)

{

if (js_iseed == 0)

{

now = new Date()

js_iseed = now.getHours() + now.getMinutes() * 60

+ now.getSeconds() * 3600

}

js_iseed1 = js_iseed / js_m2

js_iseed2 = js_iseed % js_m2

var tmp = (((js_iseed2 * js_mult1 + js_iseed1 * js_mult2) % js_m2) *

js_m2 + (js_iseed2 * js_mult2)) % js_m1

js_iseed = (tmp + 1) % js_m1

return (Math.floor((js_iseed/js_m1) * n))

}

var myNumber = 0

var nGuesses = 0

function guessnum()

{

var response

var num = parseInt(document.forms[0].guess.value)

document.forms[0].guess.value = num // visual feedback in case of NaN

nGuesses++ // increase the guess count

response = "哦,你猜的数 "

if (num < myNumber) response = response + "太小了"

if (num > myNumber) response = response + "太大了"

if (num == myNumber)

{

response = response + "对了!!你猜到我了!"

nGuesses = 0

myNumber = random(100)+1

}

document.forms[1].result.value=response

document.forms[1].guesses.value=nGuesses

document.forms[0].guess.focus()

document.forms[0].guess.select()

return true

}

function giveup()

{

var response

nGuesses = 0

response = "我的数字是" + myNumber +". 想猜我的新数吗?"

myNumber = random(100)+1

document.forms[1].result.value=response

document.forms[1].guesses.value=nGuesses

document.forms[0].guess.focus()

document.forms[0].guess.select()

}

</SCRIPT>

 

 

 

 

<!-- 2 -->

<!-- <BODY>中的属性代码改为 -->

 

<BODY onLoad="document.forms[0].guess.focus(); document.forms[0].guess.select()">

 

 

 

<!-- 3 步: -->

<!-- 把下面的代码加到<BODY></BODY>区域中: -->

 

<font size="3" color="#FF0000">

我手中有一个数,它的范围在1~100之间,你能猜到它是几吗?</font></b><font size="4">

</font>

<SCRIPT>

myNumber = random(100)+1

nGuesses = 0

</SCRIPT>

<FORM onSubmit="guessnum(); return false">

填入你猜的数: <INPUT TYPE="text" NAME="guess" SIZE=5>

<INPUT TYPE="button" VALUE=" 我来猜 " onClick="guessnum()">

<INPUT TYPE="button" VALUE=" 放弃 " onClick="giveup()">

</FORM>

<FORM>

你已猜了: <INPUT TYPE="text" NAME="guesses" SIZE=3>

提示信息: <INPUT TYPE="text" NAME="result" SIZE=35>

</FORM>

 

0 Comments

Tue

17

Mar

2009

8、在线测试10

8、在线测试10

 

 

0 Comments

Tue

17

Mar

2009

7、在线测试9

7、在线测试9

脚本说明:

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

<SCRIPT language=JavaScript>

function processForm(form){

var xf=xf1=0;

hc=new Array(20);

var roll_call=hc.length;

for (i=roll_call;i>0;i--)

{hc[i-1]=1};

//loops through the radio buttons finding out which one is selected

if (form.c1[1].checked==1) hc[0]=2;

if (form.c1[2].checked==1) hc[0]=3;

if (form.c1[3].checked==1) hc[0]=4;

if (form.c2[1].checked==1) hc[1]=2;

if (form.c2[2].checked==1) hc[1]=3;

if (form.c2[3].checked==1) hc[1]=4;

if (form.c3[1].checked==1) hc[2]=2;

if (form.c3[2].checked==1) hc[2]=3;

if (form.c3[3].checked==1) hc[2]=4;

if (form.c4[1].checked==1) hc[3]=2;

if (form.c4[2].checked==1) hc[3]=3;

if (form.c4[3].checked==1) hc[3]=4;

if (form.c5[0].checked==1) hc[4]=4;

if (form.c5[1].checked==1) hc[4]=3;

if (form.c5[2].checked==1) hc[4]=2;

if (form.c6[1].checked==1) hc[5]=2;

if (form.c6[2].checked==1) hc[5]=3;

if (form.c6[3].checked==1) hc[5]=4;

if (form.c7[1].checked==1) hc[6]=2;

if (form.c7[2].checked==1) hc[6]=3;

if (form.c7[3].checked==1) hc[6]=4;

if (form.c8[1].checked==1) hc[7]=2;

if (form.c8[2].checked==1) hc[7]=3;

if (form.c8[3].checked==1) hc[7]=4;

if (form.c9[0].checked==1) hc[8]=4;

if (form.c9[1].checked==1) hc[8]=3;

if (form.c9[2].checked==1) hc[8]=2;

if (form.c10[1].checked==1) hc[9]=2;

if (form.c10[2].checked==1) hc[9]=3;

if (form.c10[3].checked==1) hc[9]=4;

if (form.c11[1].checked==1) hc[10]=2;

if (form.c11[2].checked==1) hc[10]=3;

if (form.c11[3].checked==1) hc[10]=4;

if (form.c12[1].checked==1) hc[11]=2;

if (form.c12[2].checked==1) hc[11]=3;

if (form.c12[3].checked==1) hc[11]=4;

if (form.c13[0].checked==1) hc[12]=4;

if (form.c13[1].checked==1) hc[12]=3;

if (form.c13[2].checked==1) hc[12]=2;

if (form.c14[1].checked==1) hc[13]=2;

if (form.c14[2].checked==1) hc[13]=3;

if (form.c14[3].checked==1) hc[13]=4;

if (form.c15[1].checked==1) hc[14]=2;

if (form.c15[2].checked==1) hc[14]=3;

if (form.c15[3].checked==1) hc[14]=4;

if (form.c16[1].checked==1) hc[15]=2;

if (form.c16[2].checked==1) hc[15]=3;

if (form.c16[3].checked==1) hc[15]=4;

if (form.c17[0].checked==1) hc[16]=4;

if (form.c17[1].checked==1) hc[16]=3;

if (form.c17[2].checked==1) hc[16]=2;

if (form.c18[1].checked==1) hc[17]=2;

if (form.c18[2].checked==1) hc[17]=3;

if (form.c18[3].checked==1) hc[17]=4;

if (form.c19[0].checked==1) hc[18]=4;

if (form.c19[1].checked==1) hc[18]=3;

if (form.c19[2].checked==1) hc[18]=2;

if (form.c20[1].checked==1) hc[19]=2;

if (form.c20[2].checked==1) hc[19]=3;

if (form.c20[3].checked==1) hc[19]=4;

for (i=roll_call;i>0;i--)

{xf+=hc[i-1]};      

xf1=Math.ceil(xf*1.25);

form.answer.value="你的得分为"+xf1+"";

}</SCRIPT>

 

 

 

 

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

<TABLE border=0 cellPadding=4 cellSpacing=0 height=79 width=500>

  <TBODY>

  <TR>

    <TD align=middle height=46 width=519><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 6pt">◇◆◇◆◇</SPAN><FONT

      color=#0000ff><STRONG><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 12pt; LINE-HEIGHT: 15px">你有焦虑情绪吗</SPAN></STRONG></FONT><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 6pt">◇◆◇◆◇</SPAN></TD></TR>

  <TR>

    <TD height=18 width=519><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">仔细阅读每一题,然后根据你最近一个星期的实际感觉,选择适合的答案。</SPAN></TD></TR></TBODY></TABLE></DIV>

<FORM name=see>

<DIV align=left>

<TABLE border=0 cellPadding=10 cellSpacing=0 height=388 width=517>

  <TBODY>

  <TR>

    <TD height=1 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">1、觉得比平常容易紧张和着急。<BR><INPUT

      name=c1 type=radio value=1>没有或很少时间。<BR><INPUT name=c1 type=radio

      value=3>小部分时间。<BR><INPUT name=c1 type=radio value=5>相当多时间。<BR><INPUT

      name=c1 type=radio value=V1>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=1 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">2、无缘无故感到害怕。<BR><INPUT

      name=c2 type=radio value=11>没有或很少时间。<BR><INPUT name=c2 type=radio

      value=31>小部分时间。<BR><INPUT name=c2 type=radio value=51>相当多时间。<BR><INPUT

      name=c2 type=radio value=V2>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=1 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">3、容易心里烦乱或觉得惊慌。<BR><INPUT

      name=c3 type=radio value=12>没有或很少时间。<BR><INPUT name=c3 type=radio

      value=32>小部分时间。<BR><INPUT name=c3 type=radio value=52>相当多时间。<BR><INPUT

      name=c3 type=radio value=V3>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">4、觉得可能将要发疯。<BR><INPUT

      name=c4 type=radio value=13>没有或很少时间。<BR><INPUT name=c4 type=radio

      value=33>小部分时间。<BR><INPUT name=c4 type=radio value=53>相当多时间。<BR><INPUT

      name=c4 type=radio value=V4>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">5、觉得一切都很好,也不会发生什么不幸。<BR><INPUT

      name=c5 type=radio value=14>没有或很少时间。<BR><INPUT name=c5 type=radio

      value=34>小部分时间。<BR><INPUT name=c5 type=radio value=54>相当多时间。<BR><INPUT

      name=c5 type=radio value=V5>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">6、手脚发抖打颤。<BR><INPUT

      name=c6 type=radio value=15>没有或很少时间。<BR><INPUT name=c6 type=radio

      value=35>小部分时间。<BR><INPUT name=c6 type=radio value=55>相当多时间。<BR><INPUT

      name=c6 type=radio value=V6>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">7、因为头痛、头颈痛和背痛而苦恼。<BR><INPUT

      name=c7 type=radio value=16>没有或很少时间。<BR><INPUT name=c7 type=radio

      value=36>小部分时间。<BR><INPUT name=c7 type=radio value=56>相当多时间。<BR><INPUT

      name=c7 type=radio value=V7>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">8、感觉容易衰弱和疲乏。<BR><INPUT

      name=c8 type=radio value=17>没有或很少时间。<BR><INPUT name=c8 type=radio

      value=37>小部分时间。<BR><INPUT name=c8 type=radio value=57>相当多时间。<BR><INPUT

      name=c8 type=radio value=V8>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">9、觉得心平气和,并且容易安静地坐着。<BR><INPUT

      name=c9 type=radio value=18>没有或很少时间。<BR><INPUT name=c9 type=radio

      value=38>小部分时间。<BR><INPUT name=c9 type=radio value=58>相当多时间。<BR><INPUT

      name=c9 type=radio value=V9>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">10、觉得心跳得很快。<BR><INPUT

      name=c10 type=radio value=19>没有或很少时间。<BR><INPUT name=c10 type=radio

      value=39>小部分时间。<BR><INPUT name=c10 type=radio value=59>相当多时间。<BR><INPUT

      name=c10 type=radio value=V10>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">11、因为一阵阵头晕而苦恼。<BR><INPUT

      name=c11 type=radio value=110>没有或很少时间。<BR><INPUT name=c11 type=radio

      value=310>小部分时间。<BR><INPUT name=c11 type=radio value=510>相当多时间。<BR><INPUT

      name=c11 type=radio value=V11>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">12、有晕倒发作,或觉得要晕倒似的。<BR><INPUT

      name=c12 type=radio value=111>没有或很少时间。<BR><INPUT name=c12 type=radio

      value=311>小部分时间。<BR><INPUT name=c12 type=radio value=511>相当多时间。<BR><INPUT

      name=c12 type=radio value=V12>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">13、吸气呼气都感到很容易。<BR><INPUT

      name=c13 type=radio value=112>没有或很少时间。<BR><INPUT name=c13 type=radio

      value=312>小部分时间。<BR><INPUT name=c13 type=radio value=512>相当多时间。<BR><INPUT

      name=c13 type=radio value=V13></SPAN><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt">绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">14、手脚麻木和刺痛。<BR><INPUT

      name=c14 type=radio value=113>没有或很少时间。<BR><INPUT name=c14 type=radio

      value=313>小部分时间。<BR><INPUT name=c14 type=radio value=513>相当多时间。<BR><INPUT

      name=c14 type=radio value=V14>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">15、因为胃痛和消化不良而苦恼。<BR><INPUT

      name=c15 type=radio value=114>没有或很少时间。<BR><INPUT name=c15 type=radio

      value=314>小部分时间。<BR><INPUT name=c15 type=radio value=514>相当多时间。<BR><INPUT

      name=c15 type=radio value=V15>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">16、常常要小便。<BR><INPUT

      name=c16 type=radio value=115>没有或很少时间。<BR><INPUT name=c16 type=radio

      value=315>小部分时间。<BR><INPUT name=c16 type=radio value=515>相当多时间。<BR><INPUT

      name=c16 type=radio value=V16>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">17、手常常是干燥温暖的。<BR><INPUT

      name=c17 type=radio value=116>没有或很少时间。<BR><INPUT name=c17 type=radio

      value=316>小部分时间。<BR><INPUT name=c17 type=radio value=516>相当多时间。<BR><INPUT

      name=c17 type=radio value=V17>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">18、脸红发热。<BR><INPUT

      name=c18 type=radio value=117>没有或很少时间。<BR><INPUT name=c18 type=radio

      value=317>小部分时间。<BR><INPUT name=c18 type=radio value=517>相当多时间。<BR><INPUT

      name=c18 type=radio value=V18>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">19、容易入睡并且一夜睡得很好。<BR><INPUT

      name=c19 type=radio value=118>没有或很少时间。<BR><INPUT name=c19 type=radio

      value=318>小部分时间。<BR><INPUT name=c19 type=radio value=518>相当多时间。<BR><INPUT

      name=c19 type=radio value=V19>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD height=35 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px">20、作恶梦。<BR><INPUT

      name=c20 type=radio value=119>没有或很少时间。<BR><INPUT name=c20 type=radio

      value=319>小部分时间。<BR><INPUT name=c20 type=radio value=519>相当多时间。<BR><INPUT

      name=c20 type=radio value=V20>绝大部分或全部时间。</SPAN></TD></TR>

  <TR>

    <TD align=middle height=25 width=517><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px"><INPUT onclick=processForm(this.form) style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt" type=button value=都选择完了,结果怎样?><INPUT

      name=answer

      style="COLOR: rgb(255,0,0); FONT-FAMILY: 宋体; FONT-SIZE: 9pt"></SPAN></TD></TR></TBODY></TABLE></DIV></FORM>

<DIV align=left>

<TABLE border=0 cellPadding=4 cellSpacing=0 height=22 width=500>

  <TBODY>

  <TR>

    <TD height=22 width=520><SPAN

      style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 15px"><FONT

      color=#ff0000>说明        

      </FONT>你焦虑评定的分界值是50分,分值越高,焦虑倾向越明显。</SPAN></TD></TR></TBODY></TABLE>

 

0 Comments

Tue

17

Mar

2009

6、在线测试四8

6、在线测试四8

脚本说明:

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

<SCRIPT language=JavaScript><!--

 

function getResult(form) {

 

var score = 0

 

if (form.Q01[0].checked) { score += -1 }

if (form.Q01[1].checked) { score += 3 }

 

if (form.Q02[0].checked) { score += -1 }

if (form.Q02[1].checked) { score += 0 }

if (form.Q02[2].checked) { score += 3 }

 

 

if (form.Q03[0].checked) { score += 3 }

if (form.Q03[1].checked) { score += 0 }

 

if (form.Q04[0].checked) { score += 3 }

if (form.Q04[1].checked) { score += 0 }

if (form.Q04[2].checked) { score += -1 }

 

if (form.Q05[0].checked) { score += -1 }

if (form.Q05[1].checked) { score += 3 }

 

if (form.Q06[0].checked) { score += 3 }

if (form.Q06[1].checked) { score += -1 }

 

if (form.Q07[0].checked) { score += 3 }

if (form.Q07[1].checked) { score += 0 }

 

if (form.Q08[0].checked) { score += 3 }

if (form.Q08[1].checked) { score += 0 }

 

if (form.Q09[0].checked) { score += 3 }

if (form.Q09[1].checked) { score += -1 }

 

if (form.Q10[0].checked) { score += 3 }

if (form.Q10[1].checked) { score += -1 }

 

score1=score*100/30

if (score1 > 60) { alert('恭喜恭喜!你的成功率是'+score1+'好兆头,不是吗? ')}

if (score1 > 30 && score1 <61) { alert('你的成功率是'+score1+'。怎么办?加把劲吧!') }

if (score1 < 31 ) { alert('你的成功率只有'+score1+'。你还是放弃吧...') }

}

 

// --></SCRIPT>

 

<P><FONT color=#ff8000 size=4><STRONG>你的恋爱成功率 </STRONG></FONT></P>

<FORM name=pt1>

<OL>

  <LI>与情人相处,能否直接询问对方是不是爱你?

  <P><INPUT CHECKED name=Q01 type=radio value=1>能 <INPUT name=Q01 type=radio

  value=2>不能 </P>

  <LI>恋爱结婚主要是解决:

  <P><INPUT CHECKED name=Q02 type=radio value=1>性欲 <INPUT name=Q02 type=radio

  value=2>生活 <INPUT name=Q02 type=radio value=3>亲密伴侣</P>

  <LI>从恋爱到结婚时间是否需要长一点?

  <P><INPUT CHECKED name=Q03 type=radio value=1>要 <INPUT name=Q03 type=radio

  value=2>不要</P>

  <LI>嫉妒是什么信号?

  <P><INPUT CHECKED name=Q04 type=radio value=1>爱 <INPUT name=Q04 type=radio

  value=2>不安 <INPUT name=Q04 type=radio value=3>竞争</P>

  <LI>可以在情人面前与别的异性过于亲热吗?

  <P><INPUT CHECKED name=Q05 type=radio value=1>可以 <INPUT name=Q05 type=radio

  value=2>不可以 </P>

  <LI>能同时和两个人要好吗?

  <P><INPUT CHECKED name=Q06 type=radio value=1>不能 <INPUT name=Q06 type=radio

  value=2>能 </P>

  <LI>许多人对婚后生活满怀奢望,结果常常落空,是这样吗?

  <P><INPUT CHECKED name=Q07 type=radio value=1>是 <INPUT name=Q07 type=radio

  value=2>不是 </P>

  <LI>哪种人最经不起失恋和孤寂之苦,女人还是男人?

  <P><INPUT CHECKED name=Q08 type=radio value=1>女人 <INPUT name=Q08 type=radio

  value=2>男人 </P>

  <LI>忠贞是搞好婚姻的重要原则吗?

  <P><INPUT CHECKED name=Q09 type=radio value=1>是 <INPUT name=Q09 type=radio

  value=2>不是 <BR></P>

<LI>忠贞是搞好婚姻的重要原则吗?

  <P><INPUT CHECKED name=Q10 type=radio value=1>是 <INPUT name=Q10 type=radio

  value=2>不是 <BR></P>

</LI></OL>

<P>  <INPUT name=finish onclick=getResult(this.form) type=button value=EQ解码> <INPUT type=reset value=" RESET "></P></FORM>

 

0 Comments

Tue

17

Mar

2009

5、在线测试三6

5、在线测试三6

脚本说明:

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

<script>

 <!-- hide

 var ans = new Array;

 var done = new Array;

 var score = 0;

 // LOSER!  Don't read the answers!

 ans[1] = "c";

 ans[2] = "a";

 ans[3] = "b";

 ans[4] = "b";

 ans[5] = "d";

 ans[6] = "c";

 ans[7] = "c";

 ans[8] = "c";

 ans[9] = "d";

 ans[10] = "a";

 function Engine(question, answer) {

         if (answer != ans[question]) {

                 if (!done[question]) {

                         done[question] = -1;

                         alert("你选错了,你答对了" + score + "");

 

                         }

 

                 else {

 

                         alert("你已经选过这个了!");

 

                         }

 

                 }

 

         else {

 

                 if (!done[question]) {

 

                         done[question] = -1;

 

                         score++;

 

                         alert("恭喜你,你答对了" + score + "");

 

                         }

 

                 else {         

 

                         alert("你已经回答过这个了!");

 

                         }

 

                 }

 

 }

 

                

 

 function NextLevel () {

 

         if (score > 10) {

 

                 alert("你作弊了吧!");

 

                 }

 

         if (score >= 7 && score <= 9) {

 

                 alert("你答的不错!!!")

 

                 //self.location="GameQuiz2.htm"

 

                 }

 

         else {

 

                 alert("你还要继续努力!!!")

 

                 }

 

 }

 

 

 

 //-->

 

 </script>

 

  <form>

 

 <b>1. WARM-UP: Who created the famous <i>WarCraft 2</i>?</b><p>

 

 <input type=radio value="a" onClick="Engine(1, this.value)">Sierra On-Line<br>

 

 <input type=radio value="b" onClick="Engine(1, this.value)">BlueByte<br>

 

 <input type=radio value="c" onClick="Engine(1, this.value)">Blizzard Entertainment<br>

 

 <input type=radio value="d" onClick="Engine(1, this.value)">Microsoft<p>

 

 

 

 <b>2. This famous 3D shooter claimed <i>PC Gamer's</i> Game of 1994 Award.</b><p>

 

 <input type=radio value="a" onClick="Engine(2, this.value)">Doom<br>

 

 <input type=radio value="b" onClick="Engine(2, this.value)">Hexen<br>

 

 <input type=radio value="c" onClick="Engine(2, this.value)">Descent<br>

 

 <input type=radio value="d" onClick="Engine(2, this.value)">Wolfenstein 3D<p>

 

 

 

 <b>3. The first intergalatic combat game.  Name it.</b><p>

 

 <input type=radio value="a" onClick="Engine(3, this.value)">Master of Orion<br>

 

 <input type=radio value="b" onClick="Engine(3, this.value)">Star Control<br>

 

 <input type=radio value="c" onClick="Engine(3, this.value)">StarCraft<br>

 

 <input type=radio value="d" onClick="Engine(3, this.value)">Star Trek<p>

 

 

 

 <b>4. The game ever to contain graphics was this classic by Roberta Williams.</b><p>

 

 <input type=radio value="a" onClick="Engine(4, this.value)">King's Quest<br>

 

 <input type=radio value="b" onClick="Engine(4, this.value)">Mystery House<br>

 

 <input type=radio value="c" onClick="Engine(4, this.value)">Time Zone<br>

 

 <input type=radio value="d" onClick="Engine(4, this.value)">Mission: Asteriod<p>

 

 

 

 <b>5. The first real-time strategy game was: </b><p>

 

 <input type=radio value="a" onClick="Engine(5, this.value)">WarCraft: Orcs & Humans<br>

 

 <input type=radio value="b" onClick="Engine(5, this.value)">Command & Conquer<br>

 

 <input type=radio value="c" onClick="Engine(5, this.value)">Dune<br>

 

 <input type=radio value="d" onClick="Engine(5, this.value)">Dune 2<p>

 

 

 

 <b>6. In PC Gamer, Quake won these 'of-the-year' awards (1996): </b><p>

 

 <input type=radio value="a" onClick="Engine(6, this.value)">Best Game, Best Action Game<br>

 

 <input type=radio value="b" onClick="Engine(6, this.value)">Best Action Game, Best Multiplayer<br>

 

 <input type=radio value="c" onClick="Engine(6, this.value)">Best Sound Effects, Best Multiplayer<br>

 

 <input type=radio value="d" onClick="Engine(6, this.value)">All of the above<p>

 

 

 

 <b>7. The best selling game of all time is: </b><p>

 

 <input type=radio value="a" onClick="Engine(7, this.value)">WarCraft 2<br>

 

 <input type=radio value="b" onClick="Engine(7, this.value)">C&C: Red Alert<br>

 

 <input type=radio value="c" onClick="Engine(7, this.value)">Sim City<br>

 

 <input type=radio value="d" onClick="Engine(7, this.value)">King's Quest 5<p>

 

 

 

 <b>8. This is a turn-based strategy game: </b><p>

 

 <input type=radio value="a" onClick="Engine(8, this.value)">C&C: Red Alert<br>

 

 <input type=radio value="b" onClick="Engine(8, this.value)">Might and Magic 3<br>

 

 <input type=radio value="c" onClick="Engine(8, this.value)">Heroes of Might and Magic<br>

 

 <input type=radio value="d" onClick="Engine(8, this.value)">Daggerfall: The Elder Scrolls<p>

 

 

 

 <b>9. PC Gamer's <i>Best Game of the 1996</i> went to: </b><p>

 

 <input type=radio value="a" onClick="Engine(9, this.value)">C&C: Red Alert<br>

 

 <input type=radio value="b" onClick="Engine(9, this.value)">Tomb Raider<br>

 

 <input type=radio value="c" onClick="Engine(9, this.value)">Quake<br>

 

 <input type=radio value="d" onClick="Engine(9, this.value)">Civilization 2<p>

 

 

 

 <b>10. Blizzard's new release, <i>Diablo</i> is a: </b><p>

 

 <input type=radio value="a" onClick="Engine(10, this.value)">Role Playing Game<br>

 

 <input type=radio value="b" onClick="Engine(10, this.value)">2D Action Game<br>

 

 <input type=radio value="c" onClick="Engine(10, this.value)">3D Action Game<br>

 

 <input type=radio value="d" onClick="Engine(10, this.value)">Simulation<p>

 

 

 

 <center>

 

 <input type=button onClick="NextLevel()" value="Advance to next level">

 

 </center>

 

 </form>

 

0 Comments

Tue

17

Mar

2009

4、在线测试二5

4、在线测试二5

脚本说明:

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

<script language="JavaScript">

 

var Total_Question = 4          // 修改这里与题目数量一致

 

var msg = ""

 

// 正确答案

  var Solution = new Array(Total_Question)

  Solution[0] = "TCP/IP"

  Solution[1] = "集线器"

  Solution[2] = "SUN"

  Solution[3] = "Microsoft"

//

 

function GetSelectedButton(ButtonGroup)

{

  for (var x=0; x < ButtonGroup.length; x++)

    if (ButtonGroup[x].checked) return x

  return 0

}

 

function ReportScore(correct)

{

  var SecWin =

      window.open("","scorewin","scrollbars,width=300,height=220")

  var MustHave1 = "<HTML><HEAD><TITLE>测验成绩报告</TITLE></HEAD><BODY>"

  var Percent = "<H2>测验成绩 : "+Math.round(correct/Total_Question*100)

               + "</H2><HR>"

  lastscore=Math.round(correct/Total_Question*100)

  if (lastscore == "100"){

  msg = MustHave1 +Percent + "<font color='red'>恭喜,全部答对了!</font><p>" + msg  + "<input type='button' value='close' onclick=javascript:window.close()></BODY></HTML>"}

  else {

  msg = MustHave1 +Percent + "<font color='red'>正确答案:</font><p>" + msg  + "<input type='button' value='close' onclick=javascript:window.close()></BODY></HTML>"

} 

  SecWin.document.write(msg)

  msg = ""  //清空msg

}

 

function Grade()

{

  var correct = 0

  var wrong = 0

  for (number=0; number < Total_Question; number++)

    {

      var form = document.forms[number]      // Question #

      var i = GetSelectedButton(form.q1)

      if (form.q1[i].value == "1")

        { correct++ }

       else

        { wrong++

          msg += "Question "+(number+1)+"."

                +Solution[number]+"<BR>"

        }

    }

    ReportScore(correct)

 

}

 

 

</script>

 

 

 

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

 <table width="75%" border="0" align="center">

  <tr>

    <td>

      <form>

三个非常简单的问题:<p>

(1)Internet上使用的网络协议是:__________

<br>

<input type="radio" name="q1" value="0" checked>X.25

<input type="radio" name="q1" value="1">TCP/IP

<input type="radio" name="q1" value="0">NetBEUI

<br><br> </form>

 

<form>

(2)HUB是指:__________

<br>

<input type="radio" name="q1" value="0" checked>网桥

<input type="radio" name="q1" value="1">集线器

<input type="radio" name="q1" value="0">网关

<input type="radio" name="q1" value="0">路由器

<br><Br> </form>

 

<form>

(3)JAVA是哪个公司的产品:__________

<br>

<input type="radio" name="q1" value="0" checked>Novell

<input type="radio" name="q1" value="0">Microsoft

<input type="radio" name="q1" value="1">SUN

<br><Br> </form>

 

<form>

(4)IIS(Internet Information Server)是哪个公司的产品:__________

<br>

<input type="radio" name="q1" value="0" checked>Novell

<input type="radio" name="q1" value="1">Microsoft

<input type="radio" name="q1" value="0">Netscape

<br><Br> </form>

 

<form>

        <div align="center">

          <input type="button" name="Submit" value="看看成绩"

 onClick="Grade()" class="pt9">

        </div>

      </form>

    </td>

  </tr>

</table>

 

0 Comments

Tue

17

Mar

2009

3、在线测试一4

3、在线测试一4

脚本说明:

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

<SCRIPT LANGUAGE="JavaScript">

 

<!--

function scorequiz(form) {

 list=0

 if(form.Q1.value!=null && form.Q1.value=="*") {list=list+1}

 if(form.Q2.value!=null && form.Q2.value=="*") {list=list+1}

 if(form.Q3.value!=null && form.Q3.value=="*") {list=list+1}

 if(form.Q4.value!=null && form.Q4.value=="*") {list=list+1}

 if(form.Q5.value!=null && form.Q5.value=="*") {list=list+1}

 if(form.Q6.value!=null && form.Q6.value=="*") {list=list+1}

 if(form.Q7.value!=null && form.Q7.value=="*") {list=list+1}

 if(form.Q8.value!=null && form.Q8.value=="*") {list=list+1}

 if(form.Q9.value!=null && form.Q9.value=="*") {list=list+1}

 if(form.Q10.value!=null && form.Q10.value=="*") {list=list+1}

 form.SCORE.value =eval(list)

      if (form.SCORE.value<=8){

       ok="不及格!"}

}

 

function clearquiz(form) {

 list=0

 form.Q1.value="?"

 form.Q2.value="?"

 form.Q3.value="?"

 form.Q4.value="?"

 form.Q5.value="?"

 form.Q6.value="?"

 form.Q7.value="?"

 form.Q8.value="?"

 form.Q9.value="?"

 form.Q10.value="?"

 form.SCORE.value =eval(list)

}

 

function msg() {

 alert("感谢参加测试,您的成绩已经将mailWebmaster")

 }

// -->

 

</SCRIPT>

 

 

 

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

<table width="75%" border="0" align="center">

  <tr>

    <td>

      <form name="quiz1"

 action ="mailto:xiaoqinglu@263.net?subject=测试结果反馈" method="post" enctype="text/plain"

 onLoad="clearquiz(this.form)" onSubmit="msg()">

        您的姓名:

        <input type="Text" name="Name" value="" class="pt9">

        <br>

        <hr>

        1. Internet上使用的网络协议是:__________

        <ol>

          <input type="radio" name="Q1" value="*TCP/IP" onClick=Q1.value="*">

          TCP/IP<br>

          <input type="radio" name="Q1" value="X.25" onClick=Q1.value="X.25">

          X.25<br>

          <input type="radio" name="Q1" value="NetBEUI" onClick=Q1.value="NetBEUI">

          NetBEUI<br>

        </ol>

        2. 我们通过__________长距离连接两台计算机使它们通讯。

        <ol>

          <input type="radio" name="Q2" value="LAN" onClick=Q2.value="A">

          LAN<br>

          <input type="radio" name="Q2" value="*WAN" onClick=Q2.value="*">

          WAN<br>

          <input type="radio" name="Q2" value="WAIS" onClick=Q2.value="C">

          WAIS<br>

        </ol>

        3. HUB是指:__________

        <ol>

          <input type="radio" name="Q3" value="网关" onClick=Q3.value="网关">

          网关<br>

          <input type="radio" name="Q3" value="网桥" onClick=Q3.value="网桥">

          网桥<br>

          <input type="radio" name="Q3" value="路由器" onClick=Q3.value="路由器">

          路由器<br>

          <input type="radio" name="Q3" value="*集线器" onClick=Q3.value="*">

          集线器<br>

        </ol>

        4. 56K MODEM的传输速度为:__________

        <ol>

          <input type="radio" name="Q4" value="56Kbytes" onClick=Q4.value="A">

          每秒传输56K bytes的数据。 <br>

          <input type="radio" name="Q4" value="*56kbps" onClick=Q4.value="*">

          每秒传输56k bits的数据。 <br>

        </ol>

        5. Gateway是指:__________

        <ol>

          <input type="radio" name="Q5" value="*网关" onClick=Q5.value="*">

          网关<br>

          <input type="radio" name="Q5" value="网桥" onClick=Q5.value="B">

          网桥<br>

          <input type="radio" name="Q5" value="路由器" onClick=Q5.value="C">

          路由器<br>

          <input type="radio" name="Q5" value="集线器" onClick=Q5.value="D">

          集线器<br>

        </ol>

        6. Http默认的端口是:__________

        <ol>

          <input type="radio" name="Q6" value="8080" onClick=Q6.value="A">

          8080<br>

          <input type="radio" name="Q6" value="*80" onClick=Q6.value="*">

          80<br>

          <input type="radio" name="Q6" value="25" onClick=Q6.value="25">

          25<br>

        </ol>

        7. JavaScript是一种类似于C++的语言,比较难掌握:__________

        <ol>

          <input type="radio" name="Q7" value="True" onClick=Q7.value="T">

          True<br>

          <input type="radio" name="Q7" value="*False" onClick=Q7.value="*">

          False<br>

        </ol>

        8. JAVA __________ 公司的产品:

        <ol>

          <input type="radio" name="Q8" value="Microsoft" onClick=Q8.value="A">

          Microsoft<br>

          <input type="radio" name="Q8" value="Novell" onClick=Q8.value="B">

          Novell<br>

          <input type="radio" name="Q8" value="*SUN" onClick=Q8.value="*">

          SUN<br>

        </ol>

        9. CGI通过__________收集用户填写的表单信息:

        <ol>

          <input type="radio" name="Q9" value="Form" onClick=Q9.value="A">

          Form<br>

          <input type="radio" name="Q9" value="*环境变量" onClick=Q9.value="*">

          环境变量<br>

          <input type="radio" name="Q9" value="javascripts脚本" onClick=Q9.value="C">

          javascripts脚本<br>

        </ol>

        10. 服务器响应"404 error"的含义是: __________

        <ol>

          <input type="radio" name="Q10" value="*文件不存在" onClick=Q10.value="*">

          文件不存在<br>

          <input type="radio" name="Q10" value="Server error" onClick=Q10.value="B">

          服务器错误<br>

          <input type="radio" name="Q10" value="Client error" onClick=Q10.value="C">

          浏览器错误<br>

        </ol>

        <hr>

        <input type="button" name="submit" value="开始评分" onClick=scorequiz(this.form) class="pt9">

        <input type="reset" name="reset" value="重新测试" onClick=clearquiz(this.form) class="pt9">

        <input type="submit" value="将成绩MAIL给管理员" onClick=scorequiz(this.form) name="submit" class="pt9">

        <br>

        <br>

        你的考试成绩:

        <input  name="SCORE" type="text" class="pt9">

      </form>

</td>

  </tr>

</table>

 

0 Comments

Tue

17

Mar

2009

2、方块游戏

2、方块游戏

<html>

 

<head>

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

<meta name="GENERATOR" content="Microsoft FrontPage 6.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<title>网页特效---俄罗斯方块游戏</title>

<style>

TD{width: 20; height: 20}

</style>

</head>

 

<body bgcolor="#000000" text="#0099FF" link="#0099FF" vlink="#0099FF" alink="#0099FF" style="line-height: 150%">

<script>

 

       document.body.innerHTML += '<DIV id="stage" style="position: absolute; top: 0; left: 0;"></DIV>' //游戏场地

       document.body.innerHTML += '<div id="element_stage" style="position: absolute; top: 3; left: 500; width: 159; height: 152"></div>';//预显表

       document.body.innerHTML += '<div id="obj_stage" style="position: absolute; top: 0; left: 132; display: block; z-index: 100"></div>';//活动层

      

      

       var element_html = '<table id="element_table" border="1" width="100%" height="100%" bordercolor="#000000" cellspacing="0" cellpadding="0">';

       var obj_html     = '<table id="obj_table" border="1" bordercolor="#000000" cellspacing="0" cellpadding="0">';

      

      

      

       for(h=0;h<=4;h++)       //-------生成预显表 活动层-------//

       {

              element_html += "<tr>";

              obj_html     += "<tr>";

             

             

              for(w=0;w<=4;w++)

              {

                     element_html += "<td  bgcolor=\"\" value=\"0\"></td>";

                     obj_html += "<td bgcolor=\"\" value=\"0\"></td>";                 

                    

              }

             

              element_html += "</tr>";

              obj_html += "</tr>";

       }

      

       element_html += "</table>";

       obj_html += "</table>";

      

      

       element_stage.innerHTML = element_html;

       obj_stage.innerHTML     = obj_html;

      

       document.body.innerHTML +='<p align="right"> <span id="game_number">1</span> </p><p align="right">消除行数<br><span id="game_line">0</span></p><p align="right">游戏得分<br><span id="game_score">0</span></p>p align="right"> </p><p align="right"><a href="javascript:;" value="0" onclick="If_play(this.value)">  </a> </p> '

      

 

 

       var map = new Array(       //地图

 

              "111000000000000111","111000000000000111","111000000000000111","111000000000000111","111000000000000111",

              "111000000000000111","111000000000000111","111000000000000111","111000000000000111","111000000000000111",

              "111000000000000111","111000000000000111","111000000000000111","111000000000000111","111000000000000111",

              "111000000000000111","111000000000000111","111000000000000111","111000000000000111","111000000000000111",

              "222222222222222222","222222222222222222"             

       );

      

//-------------L------------//     //演员表

       var L1 = new Array("0000","1000","1000","1100");

      

       var L2 = new Array("0000","0000","0010","1110");

      

       var L3 = new Array("0000","0110","0010","0010");

             

       var L4 = new Array("0000","1110","1000","0000");

//-------------L-------------//   

 

 

//-------------J------------//    

       var J1 = new Array("0000","0010","0010","0110");

      

       var J2 = new Array("0000","0000","1110","0010");

      

       var J3 = new Array("0000","1100","1000","1000");

      

       var J4 = new Array("0000","0000","1000","1110");

//-------------J-------------//   

      

      

//-------------Z------------//    

       var Z1 = new Array("0000","0000","1100","0110");

      

       var Z2 = new Array("0000","0100","1100","1000");

      

       var Z3 = new Array("0000","0000","1100","0110");

             

       var Z4 = new Array("0000","0100","1100","1000");

//-------------Z-------------//   

 

 

      

//-------------S------------//    

       var S1 = new Array("0000","0000","0110","1100");

      

       var S2 = new Array("0000","0100","0110","0010");

      

       var S3 = new Array("0000","0000","0110","1100");

             

       var S4 = new Array("0000","0100","0110","0010");

//-------------S-------------//   

 

 

//-------------T------------//    

       var T1 = new Array("0000","0000","0100","1110");

      

       var T2 = new Array("0000","0010","0110","0010");

      

       var T3 = new Array("0000","1110","0100","0000");

             

      

       var T4 = new Array("0000","1000","1100","1000");

//-------------T-------------//   

 

 

//-------------M------------//   

       var M1 = new Array("0000","0000","1100","1100");

      

       var M2 = new Array("0000","0000","1100","1100");

      

       var M3 = new Array("0000","0000","1100","1100");

             

       var M4 = new Array("0000","0000","1100","1100");

//-------------M-------------//  

 

 

//-------------I------------//     

       var I1 = new Array("1000","1000","1000","1000");

      

       var I2 = new Array("0000","0000","0000","1111");

      

       var I3 = new Array("0010","0010","0010","0010");

             

       var I4 = new Array("0000","0000","0000","1111");

//-------------I-------------//   

 

 

//-------------演员位置表-------------//

 

       var players = new Array("I","J","T","L","Z","S","M");

      

       //----生成地图--------//

      

      

       function get_color(color_value)

       {

              if(color_value=="1"||color_value=="2")

                     return "#000080";

              else

                     return "#000000"; 

       }

      

      

      

      

       var map_html = '<table id="map_table" border="1" cellspacing="0" cellpadding="0" bgcolor="#000000" bordercolor="#000000">';

      

       for(h=0;h<map.length;h++)

       {

              map_html+="<tr>"

             

              for(w=0;w<map[0].length;w++)

              {

                     map_html+="<td value=\""+map[h].charAt(w)+"\" bgcolor=\""+get_color(map[h].charAt(w))+"\">"

                    

 

              }

             

              map_html +="</tr>"

       }

      

       map_html+="</table>"

      

       stage.innerHTML = map_html

      

       //----生成地图--------//

/****************************************** 上面是准备的代码****************************************************/

 

      

       function Y_X(y,x) //设置角的对象

       {

              this.x = x;

              this.y = y;

       }    

      

       var game_l_u_angle = new Y_X(0,6);      //方快初始 左上角   右上角 x y 坐标

       var game_r_d_angle = new Y_X(3,9);

      

       var left_up_angle = new Y_X(game_l_u_angle.y,game_l_u_angle.x); //现在的 左上角的 x y 坐标

       var right_down_angle = new Y_X(game_r_d_angle.y,game_r_d_angle.x); //现在的 右上角 x y 坐标

      

       var block_color_1 = "#0099FF"; //现在的方块的颜色

       var block_color_0 = "";        //背景颜色

      

       var map_color_1 = "#000080"; //map 背景颜色 1

       var map_color_0 = "#000000";        //背景颜色 0

 

       var block_width = "22"; //方块 边长

       var block_height = "20";

      

       var game_speed = 540 //游戏速度

       var game_max_speed = Math.floor(game_speed/20);

             

       var SHAPES = new Array("I","M","Z","J","T","S","L"); // 方块形状数组

 

       var shape_now = SHAPES[returnONE(6)];  //现在的方块形状

       var shape_will = SHAPES[returnONE(6)]; //将来的方块形状

      

       var shape_num = 1;

      

       var obj_start_left = 132;     //方块起始位置

       var obj_start_top  = 0;

 

      

       var can_move_block = false;  //设置用户是否可以移动方块

       var can_play       = false;  //游戏的开始

      

       var one_score  = 10;  //一个的得分

       var block_score = 4*one_score //一个方块的得分

       var line_score  =  12*one_score //一行的得分

      

/*******************************************上面是数据********************下面是具体运行 函数************************/

 

//------------返回任意数--------------------//

 

              function returnONE(JSnum){

             

                     JSnum = Math.round(JSnum*Math.random()*100/100);

             

                     return JSnum;

              }           

 

//--------------返回最高-----------------------//

 

       function return_TOP()

       {

              var block_value = "";

      

              for(h=0;h<4;h++)

              {

                     for(w=0;w<4;w++)

                     {

                            block_value = obj_table.rows(h).cells(w).value;

                           

                            if(block_value=="1")

                                   return (h + left_up_angle.y)

                     }

              }

       }

 

 

 

//---------设置 obj 显示 指定 type+num 方块   -----------//

 

       function set_block(obj,type,num)

       {

              var block = eval(type+num); //获得 指定 方块

             

              var block_value = "";

              var block_color = "";

             

              for(h=0;h<block.length;h++)

              {

                     for(w=0;w<block[0].length;w++)

                     {

                            block_value = block[h].charAt(w);

                            block_color = eval("block_color_" + block_value );

                           

                            with(obj.rows(h).cells(w))

                            {

                                   bgColor = block_color;

                                   value   = block_value;

                            }

                     }

              }

             

       }

 

 

//-------------使 obj 相对移动--------------//

 

       function move_block_by(x,y)

       {

              left_up_angle.x += x;

              left_up_angle.y += y;

             

              right_down_angle.x += x;