All pastes #2104125 Raw Edit

Mine

public text v1 · immutable
#2104125 ·published 2012-01-19 17:29 UTC
rendered paste body
<html>
 
<head>
  <title>Battleships of the Cells!</title>
  <style type='text/css'>
     BODY { background-color: #32A3A9; }
    .header_cell { width: 60px; text-align: center; } 
    #correct { width: 40px; color: darkgreen; text-align: center; }
    #wrong { width: 40px; color: red; text-align: center; }
  </style>
  
  <script type='text/javascript'>
var cur_globa="";
var posi_ships = [ String.fromCharCode(65) + "7" , String.fromCharCode(66) +"5", String.fromCharCode(67) +"2" , String.fromCharCode(68) +"8" , String.fromCharCode(69) +"4" , String.fromCharCode(65) +"8" , String.fromCharCode(66) +"6" ];
function pick_new_cell(){
  var mTD = document.getElementById('main_table').getElementsByTagName('TD');
  for(i=0;i<mTD.length;i++) mTD[i].style.backgroundColor='#ffffff';
  if(cur_globa != "") document.getElementById('new_row').innerHTML = cur_globa;
  var col = String.fromCharCode( 65 + Math.floor(Math.random()*9));
  var row = Math.floor(Math.random()*9)+1;
  cur_globa=col+row;
  if(document.getElementById(col + row).innerHTML.match(/battleship/i) != null) pick_new_cell();
  document.getElementById(col + row).style.backgroundColor='#00ff00';
}
 
function renew_score(){
  document.getElementById('error_message').innerHTML="";
  if(document.getElementById('my_answer').value==""  || !document.getElementById(document.getElementById('my_answer').value)){
	document.getElementById('error_message').innerHTML="That Cell Reference Doesn't Make Sense!";
	return false;
  }
  if(document.getElementById(document.getElementById('my_answer').value).style.backgroundColor=='#00ff00'){
    document.getElementById('correct').innerHTML = Math.floor( document.getElementById('correct').innerHTML) + 1;
  } else {
    document.getElementById('wrong').innerHTML = Math.floor( document.getElementById('wrong').innerHTML) + 1;
  }
  for(i=0;i<posi_ships.length;i++){
    if(cur_globa==posi_ships[i]){ 
      document.getElementById(document.getElementById('my_answer').value).innerHTML = "<img src='battleship.jpg' />";
    }
  }
  document.getElementById('my_answer').value="";
  pick_new_cell();
}
  </script>
</head>
 
<body>
<h1></h1>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="98" height="85" valign="top" style="font-size: 25px;">Battleships!</td>
    <td width="66%" style="background-image:url('Banner-Bottom.png')">&nbsp;</td>
 
	<td style=""><div align="center" style="color: #FF0000; font-weight: bold; font-size: 20px;">TES<br />
    Battleships!!</div></td>
  </tr>
</table>
<br /><br />
<script type='text/javascript'>
var iTable = "<table id='main_table' border='1' bordercolor='#c0c0c0' ><tr><td class='header_cell'>&nbsp;</td>";
for(i=0;i<9;i++){
  iTable+="<td class='header_cell'>" + String.fromCharCode(i+65) + "</td>";
}
iTable+="</tr>";
for(i=0;i<9;i++){
  iTable+="<tr style='height:30px; text-align: center;'>";
  for(u=0;u<10;u++){
    iTable+="<td " + (u==0 ? "" : "id='" + String.fromCharCode((u-1)+65)+(i+1) + "'" ) + ">" + (u==0 ? (i+1) : "&nbsp;" ) + "</td>";
  }
  iTable+="</tr>";
}
iTable+="</table>";
document.write(iTable);
</script>
 
<br />
 
Type Your Cell Reference Guess In Here: <input type='text' id='my_answer' size='6' maxlength='3' /> <input type='submit' value='Submit Your Answer' onclick='renew_score()' /> <span id='error_message' style='color: red; text-align: center;' ></span>
 
<br /><br />
 
<table border='1'>
<tr><td style='width: 100px; text-align: right;'>Correct:</td><td id='correct'>0</td><td style='width: 100px; text-align: right;'>Wrong:</td><td id='wrong'>0</td></tr>
<tr><td colspan='3' style='background-color: #f0f0f0'>The Last Cell Reference Was:</td><td id='new_row' style='text-align: center;background-color: #f0f0f0;'>&nbsp;</td></tr>
 
</table>
<script type='text/javascript'>pick_new_cell();</script>
</body>
</html>