Chestii-tari - tutoriale,trucuri si distractie doar aici

Va rugam sa va logati pentru a putea cedea link-urile din post-uri!

Multumim

Chestii-tari.hitforum.ro va indeamna sa gasiti ceea ce cautati!

Creeaza-ti propriul server de ikariam ,gladiatus ,triburile sau travian...mai multe informatii gasiti pe acest forum! Have a Smile) day!

    Jocuri java

    Distribuiţi
    avatar
    Admin
    Admin

    Mesaje : 215
    galbeni : 603
    Reputatie : 0
    Data de inscriere : 17/11/2011

    Jocuri java

    Mesaj  Admin la data de Dum Iun 10, 2012 2:35 am

    Checkbox

    Cod:

    <SCRIPT LANGUAGE="JavaScript">
    <!--// Copyright (c) 1996 Tomer Shiran. All rights reserved.
    // Permission given to use this script provided that the copyright
    // notice remains as is. Additional scripts and information are
    // available at http://www.geocities.com/SiliconValley/9000/
    // assign initial values to global variables
    var total = 0
    var play = false
    // react to a click in a checkbox (element == clicked checkbox object)

    function display(element) {   
       // assign instance of Date object representing current time   
          var now = new Date()   
       // if the game has not started yet   
          if (!play) {      
       // game starts now      
          play = true      
       // milliseconds since 1970 for time at beginning       
          startTime = now.getTime()   
       }   
       // if more than 20 seconds have passed since startTime was last set   
          if (now.getTime() - startTime > 20000) {      
             // reject modification (make "read-only")      
                element.checked = !element.checked      
             // terminate function      
             return   
          }   
       // if the clicked checkbox is now checked   
          if (element.checked)      
             // increment total      
                total++
          else      
             // decrement total      
                total--   
             // display total in text object   
                element.form.num.value = total
    }

    function restart(form) {   
       // set global variables back to initial values   
          total = 0   
          play = false   
       // uncheck all 100 checkboxes   
          for (var i = 1; i <= 100; ++i) {      
             // uncheck current checkbox      
                form.elements[i].checked = false   
          }
    }
    // -->
    </SCRIPT>
    <!-- ValueClick Media POP-UNDER CODE v1.8 for free-javascripts.com (12 hour) -->
    <script language="javascript"><!--                               
    var dc=document; var date_ob=new Date();
    dc.cookie='h2=o; path=/;';var bust=date_ob.getSeconds();
    if(dc.cookie.indexOf('e=llo') <= 0 && dc.cookie.indexOf('2=o') > 0){
    dc.write('<scr'+'ipt language="javascript" src="http://media.fastclick.net');
    dc.write('/w/pop.cgi?sid=38451&m=2&tp=2&v=1.8&c='+bust+'"></scr'+'ipt>');
    date_ob.setTime(date_ob.getTime()+43200000);
    dc.cookie='he=llo; path=/; expires='+ date_ob.toGMTString();} // -->
    </script>                                                         
    <!-- ValueClick Media POP-UNDER CODE v1.8 for free-javascripts.com -->
    </head>

    <SCRIPT LANGUAGE="JavaScript">
    <!--// immediate script (executed before the other script because it is deferred)
       document.write("<FORM><div align="center">")
       document.write('<INPUT TYPE="text" VALUE="0" NAME="num" SIZE=10 onFocus="this.blur()"><BR>')
       document.write("<HR SIZE=1 WIDTH=40%>")
    // use loop to create a 10 x 10 square of checkboxes
       for (var i = 0; i < 10; ++i) {   
          for (var j = 0; j < 10; ++j) {      
             // write checkbox with "display(this)" as event handler script      
                document.write('<INPUT TYPE="checkbox" onClick="display(this)">')   
          }   
          document.write("<BR>")
       }
       document.write("<HR SIZE=1 WIDTH=40%>")
       // create button to call restart function to restart game
          document.write('<INPUT TYPE="button" VALUE="restart" onClick="restart(this.form)">')
          document.write("</div></FORM>")
    // -->
    </SCRIPT>





    Classic Pong


    Cod:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- For this and 100s of other Free Javascripts, check out: -->
    <!-- Free-Javascripts.com @ http://www.free-javascripts.com/ -->

    <!--  to hide script contents from old browsers
    // rev 0.04
    var crlf = "\r\n"; 
    // should determine from browser type
       var x = 1;
       var y = 1;
       var dx = 1;
       var dy = 1;
       var s = "";
       var u = 0;
       var oops_flag = false;
       var score = 0;

    function move1() {
        x += dx;
        if (x > 31) {
       x -= 2 * Math.abs(dx);
        if (dx > 0) dx = -dx; }
        if (x <  0) {
       x += 2 * Math.abs(dx);
        if (dx < 0) dx = -dx; }
       y += dy;
        if (y > 14) {
       y -= 2 * Math.abs(dy);
        if (dy > 0) dy = -dy;
        if (Math.abs(x - 2*u - 1) > 2) {
       oops_flag = true;
        }
        else {
       score += 1;       
       }   

        }
        if (y <  0) { y += 2 * Math.abs(dy);
    if (dy < 0) dy = -dy; }
      }


    function display1() {
        var s1 = ""
        var i,j;
        if (oops_flag) return "Doh! You've been beaten by the oldest game in the world. Take note of your best score and keep practicing. No, really, it's important.";
        for (j=0;j<15;j++) {

          for (i=0;i<32;i++) {
       if (j == y && i == x) s1 += "o";
            else s1 += ".";
          }
          s1 += crlf;
        }
        var s2 = ""
        for (i=0;i<16;i++) {
          if (u == i) s2 += "==";
          else s2 += "..";
        }
        return (s1+s2)
      }
      var timerID = null;
      var timerRunning = false;
      var myform;

    function stopclock (){
            if(timerRunning) clearTimeout(timerID);
            timerRunning = false;
      }

    function startclock (form) {
            myform = form;
       oops_flag = false;
       if (navigator.userAgent.indexOf("Mac") > 2) crlf = "\n";
       // Make sure the clock is stopped
            stopclock();
            dotime();
      }

    function dotime () {
       move1();
            if (myform != null) {
         myform.text3.value = display1();    
         myform.score.value = " " + score;
       }
       if (!oops_flag) timerID = setTimeout("dotime()",200);
            timerRunning = true;
      }
    // end hiding contents from old browsers  -->
    </SCRIPT>

    <FORM NAME="myForm"<
    <TEXTAREA NAME="text3" ROWS=16 COLS=34 WRAP<
    [game field]
    </TEXTAREA<
    Score: <INPUT TYPE="text" NAME="score" SIZE=10 VALUE=0<
    <p<
    <a href="" onMouseOver="u =  0">\\\</a>
    <a href="" onMouseOver="u =  1">///</a>
    <a href="" onMouseOver="u =  2">\\\</a>
    <a href="" onMouseOver="u =  3">///</a>
    <a href="" onMouseOver="u =  4">\\\</a>
    <a href="" onMouseOver="u =  5">///</a>
    <a href="" onMouseOver="u =  6">\\\</a>
    <a href="" onMouseOver="u =  7">///</a>
    <a href="" onMouseOver="u =  8">\\\</a>
    <a href="" onMouseOver="u =  9">///</a>
    <a href="" onMouseOver="u = 10">\\\</a>
    <a href="" onMouseOver="u = 11">///</a>
    <a href="" onMouseOver="u = 12">\\\</a>
    <a href="" onMouseOver="u = 13">///</a>
    <a href="" onMouseOver="u = 14">\\\</a>
    <a href="" onMouseOver="u = 15">///</a>
    .... wave your cursor here
    <BR><BR<
    <INPUT TYPE="button" NAME="Button1" VALUE="[ Start Game ]" onCLick="startclock(this.form)"<
    </FORM<
    </CENTER<



    Spanzuratoarea

    Cod:

    <body onload="count();">

    <table border=1><tr>
     <form name="hang"><td align="center" colspan=13>
    <font face="Comic Sans MS, Arial, Helvetica" color="teal" size="+1"><b>HANGMAN</b></font></td></tr>
     <input type="hidden" name="word" value="">

    <script language="javascript">
    <!-- This Script Created by D10n...(for Becky Flesher): http://members.xoom.com/yoboseyo/js/ -->
    <!-- For this and 100s of other Free Javascripts, check out: -->
    <!-- Free-Javascripts.com @ http://www.free-javascripts.com/ -->

    var words=new Array();
    words[0] = "GEORGE WASHINGTON";
    words[1] = "JOHN ADAMS";
    words[2] = "THOMAS JEFFERSON";
    words[3] = "JAMES MADISON";
    words[4] = "JAMES MONROE";
    words[5] = "JOHN QUINCY ADAMS";
    words[6] = "ANDREW JACKSON";
    words[7] = "MARTIN VAN BUREN";
    words[8] = "WILLIAM HENRY HARRISON";
    words[9] = "JOHN TYLER";
    words[10] = "JAMES POLK";
    words[11] = "ZACHARY TAYLOR";
    words[12] = "MILLARD FILLMORE";
    words[13] = "FRANKLIN PIERCE";
    words[14] = "JAMES BUCHANAN";
    words[15] = "ABRAHAM LINCOLN";
    words[16] = "ANDREW JOHNSON";
    words[17] = "ULYSSES GRANT";
    words[18] = "RUTHERFORD HAYES";
    words[19] = "JAMES GARFIELD";
    words[20] = "CHESTER ARTHUR";
    words[21] = "GROVER CLEVELAND";
    words[22] = "BENJAMIN HARRISON";
    words[23] = "GROVER CLEVELAND";
    words[24] = "WILLIAM MCKINLEY";
    words[25] = "THEODORE ROOSEVELT";
    words[26] = "WILLIAM HOWARD TAFT";
    words[27] = "WOODROW WILSON";
    words[28] = "WARREN HARDING";
    words[29] = "CALVIN COOLIDGE";
    words[30] = "HERBERT HOOVER";
    words[31] = "FRANKLIN ROOSEVELT";
    words[32] = "HARRY TRUMAN";
    words[33] = "DWIGHT EISENHOWER";
    words[34] = "JOHN KENNEDY";
    words[35] = "LYNDON JOHNSON";
    words[36] = "RICHARD NIXON";
    words[37] = "GERALD FORD";
    words[38] = "JIMMY CARTER";
    words[39] = "RONALD REAGAN";
    words[40] = "GEORGE BUSH";
    words[41] = "BILL CLINTON";

    alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    ltr=0; ltc=0;
    for (i=0;i<2;i++)
     { document.write("<tr>");
      for (j=0;j<13;j++)
        { a='<td><tt><input type="button" value=" ';
          a+=alpha.substring(ltr,ltr+1)+' " onclick="';
          document.write(a+'letter(this);"></tt></td>'); ltr++; };
      document.write("</tr>"); };

    var rnd=Math.floor(Math.random()*words.length);
    document.hang.word.value=words[rnd].toUpperCase();
    document.write('<tr><td colspan=13 align="center"><tt><font size=+2>');
    for (i=0;i<words[rnd].length;i++)
     { a=words[rnd].substring(i,i+1);
      if (alpha.indexOf(a,0)>-1) { a="*"; ltc++; };
      document.write('<input type="button" value="'+a+'">'); };
    document.write('</font></tt></td></tr>');

    function letter(l)
     { a=l.value.substring(1,2); l.value="  "; dh=document.hang;
      if (a!=" ")
        { w=dh.word.value;
          b=w.indexOf(a,0); f=1; dhl=dh.left;
          while (b>-1)
          { dh.elements[b+27].value=a;
            b=w.indexOf(a,b+1); f=0; ltc--; };
          dhl.value-=f;
          if (dhl.value==0)
          for (j=0;j<26;j++)
            dh.elements[j+1].click();
        }; };
    function count()
     { dh=document.hang; dhc=dh.clock; dhl=dh.left;
      dhc.value-=1; v=dhl.value*ltc*dhc.value
      if (v>0)
        setTimeout("count();",1000);
      else
        { msg="Congratulations!";
          if (dhl.value<0)
          msg="You Have No More Tries!";
          if (ltc>0)
          msg="Time Out! Answer:\n"+dh.word.value;
          dhl.value="0";
          alert(msg);
        }; };
    </script>
    <tr><td align="center" colspan=5>TURNS LEFT:<input type="button" value="10" name="left"></td>
    <td colspan=5 align="center">TIME REMAINING:<input type="button" value="60" name="clock"></td>
    <td colspan=3 align="center"><input type="button" value="Again" onclick="location='hangman.html';">
    </td></form></tr></table>


    X si 0


    Cod:
    <SCRIPT LANGUAGE="LiveScript">
    <!-- This Script Created by Chris Englmeier: http://www.geocities.com/SiliconValley/Heights/2052/ -->
    <!-- For this and 100s of other Free Javascripts, check out: -->
    <!-- Free-Javascripts.com @ http://www.free-javascripts.com/ -->

            <!--
          step = 0;
          diff=3;
          // change board when button is clicked
            function clear_all(form) {
             step = 0;
             for (i=0;i<9; ++i) {
                position="a"+i;
                form[position].value="";
             }
          }
          // change board when button is clicked
            function clickit(field) {
          if (step == -1) {alert("Reset to play again"); return;}

            position=field.name.substring(1,2,1);
            position = 'a'+position;
          if (field.form[position].value !="") {alert("Can't go there"); return;}
            field.form[position].value="X";
            if (eval_pos(field.form)) {
             field.form.output.value="You Win!";
             step = -1;
             return;
          }
            position=get_move(field.form);
            field.form.output.value='I moved to ' + position.substring(1,2,1);
          if (position=="") {
             field.form.output.value="No Winner.";
             step = -1;

             return;
          }
            field.form[position].value="O";
            if (eval_pos(field.form)) {
             field.form.output.value="You Lose!";
             step = -1;
          }
            }

          // see if there is a winner
            function eval_pos(form) {
            if ((form.a0.value!="" &&
             form.a0.value==form.a3.value && form.a0.value==form.a6.value)||

              (form.a0.value!=""
             && form.a0.value==form.a1.value && form.a0.value==form.a2.value) ||
              (form.a0.value!=""
             && form.a0.value==form.a4.value && form.a0.value==form.a8.value) ||
              (form.a1.value!=""
             && form.a1.value==form.a4.value && form.a1.value==form.a7.value) ||
              (form.a2.value!=""
             && form.a2.value==form.a5.value && form.a2.value==form.a8.value) ||
              (form.a2.value!=""
             && form.a2.value==form.a4.value && form.a2.value==form.a6.value) ||
              (form.a3.value!=""
             && form.a3.value==form.a4.value && form.a3.value==form.a5.value) ||
              (form.a6.value!=""
             && form.a6.value==form.a7.value && form.a6.value==form.a8.value))
             return true;
          else   
              return false;
            }

          function f(a) {
          if (a == "") return "."; else return a;
          }

          // get position for move.
            function comp_move(form,player,weight,depth) {

                var cost;
             var bestcost=-2;
             var position;
             var newplayer;
             if (player=="X") newplayer="O"; else newplayer="X";
             if (depth==diff) return 0;

             if (eval_pos(form)) return 1;
             for (var i=0; i<9; ++i) {
                position='a'+i;
                if (form[position].value != "")
                   continue;
                form[position].value=player;
                cost = comp_move(form,newplayer, -weight, depth+1);
                if (cost > bestcost) {
                   bestcost=cost;
                   if (cost==1) i=9;
                }
                form[position].value="";
             }
             if (bestcost==-2) bestcost=0;
             return(-bestcost);
          }

          // get position for move.
            function get_move(form) {
             var cost;
             var bestcost=-2;
             bestmove="";
             // don't think about first move.
             if (step++ == 0)
                if (form.a4.value=="")
                   return "a4";
                else
                if (form.a0.value=="")
                   return "a0";

             for (var i=0; i<9; ++i) {
                localposition='a'+i;
                if (form[localposition].value != "")
                   continue;
                form[localposition].value="O";
                cost=comp_move(form,"X", -1, 0);
                if (cost > bestcost) {
                   if (cost==1) i=9;
                   bestmove=localposition;
                   bestcost=cost;
                }
                form[localposition].value="";
             }
             return bestmove;
            }

          // complain if user attempts to change board
            function complain(field) {
             field.form.output.focus(); // put focus eleswhere
             alert("Don't change the game fields directly!");
            }
       //a href="http://www.ucsd.edu/
            // the end -->
          </SCRIPT>


        <FORM>


       <INPUT SIZE=1 NAME="a0" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b0" OnClick="clickit(this)">
       <INPUT SIZE=1 NAME="a1" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b1" OnClick="clickit(this)">
       <INPUT SIZE=1 NAME="a2" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b2" OnClick="clickit(this)">
        <BR>

       <INPUT SIZE=1 NAME="a3" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b3" OnClick="clickit(this)">
       <INPUT SIZE=1 NAME="a4" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b4" OnClick="clickit(this)">
       <INPUT SIZE=1 NAME="a5" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b5" OnClick="clickit(this)">
        <BR>

       <INPUT SIZE=1 NAME="a6" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b6" OnClick="clickit(this)">
       <INPUT SIZE=1 NAME="a7" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b7" OnClick="clickit(this)">
       <INPUT SIZE=1 NAME="a8" OnFocus="complain(this)">
       <INPUT TYPE="button" NAME="b8" OnClick="clickit(this)">
        <BR>
        <BR>
        <BR>

       
       Message: <INPUT NAME="output" TYPE="text"><BR>
        <BR>
       Difficulty: <SELECT NAME="difficulty"
          OnChange="diff=form.difficulty[form.difficulty.selectedIndex].value;">
       <OPTION VALUE=1> Very Easy
       <OPTION VALUE=2> Easy
       <OPTION VALUE=3 SELECTED> Medium
       <OPTION VALUE=4> Hard (may think a long time)
       </SELECT>
       <BR><INPUT TYPE="button" VALUE="Computer Moves First" OnClick="
          if (!step++) this.form.a4.value='O';">

       <BR><INPUT TYPE="reset" VALUE="Restart" OnClick="clear_all(this.form)">

          
       </FORM>



      Acum este: Mar Dec 11, 2018 8:15 am