<HEAD>
<TITLE>Example 6</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var n,r,t;
function dispbin(x){
  var i;
  for(i=0;i<r;i++){
    if(x%Math.pow(2,r-i)>=Math.pow(2,r-i-1))
      document.forms[0].elements[i].checked=true;
    else
      document.forms[0].elements[i].checked=false;
  }
  x++;
  if(x<=n)
    t=setTimeout("clearTimeout(t);dispbin("+x+")",200);
  else{
    n=prompt("number?","");
    if(n==null){
      document.cookie=0;
      return;
    }
    document.cookie=n;
    location.href="example6.html";
  }
  return;
}
//-->
</SCRIPT>
</HEAD>
<BODY onLoad="dispbin(0)">
<H1>Example 6</H1>
<FORM>
<SCRIPT LANGUAGE="JavaScript">
<!--
n=parseFloat(document.cookie);
r=(n>0)?Math.ceil(Math.log(n+1)/Math.log(16))*4:4;
for(t=0;t<r;t++)
  document.write("<INPUT TYPE=CHECKBOX>");
//-->
</SCRIPT>
</FORM>
</BODY>