»
EnglishFrenchVietnamese

Print - Magic Square - JavaScriptBank.com

Full version: jsB@nk » Game » Puzzle » Magic Square
URL: https://www.javascriptbank.com/magic-square.html

Magic Square © JavaScriptBank.comPut the numbers in order so that they read 1-8. The 0 is the 'empty' place. Click on any number next to 0 and they will switch places.

Full version: jsB@nk » Game » Puzzle » Magic Square
URL: https://www.javascriptbank.com/magic-square.html



CSS
<STYLE type=text/css>.num {FONT-SIZE: 12px; WIDTH: 30px; COLOR: #000; FONT-FAMILY: verdana; TEXT-ALIGN: right}.symbols {FONT-SIZE: 30px; BACKGROUND: #000; COLOR: #f1f1f1; FONT-FAMILY: wingdings; TEXT-ALIGN: center}.viewsymbol {FONT-SIZE: 100px; BACKGROUND: #000; WIDTH: 150px; COLOR: #f1f1f1; FONT-FAMILY: wingdings; HEIGHT: 150px}</STYLE><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<SCRIPT language=javascript>ax=0;function viewtable() { ax=Math.round(Math.random()*26); alphaArray=new Array("a", "n", "b", "d", "f", "h", "{", "i", "l", "v", "x", "z", "I", "J", "M", "N", "o", "O", "R", "S", "T", "U", "m", "6", "^", "u", "_", "[", "]"); table="<table align=\"center\" border=\"0\" cellspacing=\"5\" cellpadding=\"1\"><tr>"; j=1;  for ( i = 99 ; i >= 0 ; i-- ) {   a=Math.round(Math.random()*26);   if(i%9 == 0 &&  i < 89)   a=ax;   table+="<td class=\"num\">"+i+"</td><td class=\"symbols\">"+alphaArray[a]+"</td>";   if(j%10 == 0) table+="</tr><tr>"; j++;  } table+="</table>";  sym.innerHTML=table sh.innerHTML=""}function show() { sh.innerHTML=alphaArray[ax] sym.innerHTML="<center>Guess? :) <a href=\"javascript:viewtable()\">Repeat</a></center>";}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=viewtable();><TABLE cellSpacing=0 width="100%" border=0>        <TBODY>        <TR>          <TD vAlign=top>            <DD>&quot;Magic Square&quot; will guess a symbol you choose. Any magic, just javascript. But very interesting!            <DD>1.&nbsp;Conceive any two-digit number<BR>            <DD>2.&nbsp;Deduct from this number it&#39;s digits (e.g., from number 54 it&#39;s needed to deduct digits 5 and 4. Result is 45<BR>            <DD>3.&nbsp;Find this number and corresponding symbol in the table below<BR>            <DD>4.&nbsp;Imagine this symbol in your mind<BR>            <DD>5.&nbsp;Click on the square<BR>            <P></P>            <TABLE style="CURSOR: hand" onclick=show() cellSpacing=10             align=center border=0>              <TBODY>              <TR>                <TD class=viewsymbol id=sh             align=middle>&nbsp;</TD></TR></TBODY></TABLE></DD></TD></TR>        <TR>          <TD id=sym vAlign=top></TD></TR></TBODY></TABLE></TD>    <TD></TD></TR></TBODY></TABLE></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->