Skip to content

Instantly share code, notes, and snippets.

@imaz
Created August 5, 2011 09:13
Show Gist options
  • Save imaz/1127177 to your computer and use it in GitHub Desktop.
Save imaz/1127177 to your computer and use it in GitHub Desktop.
CodeBreaker(4桁とれたとこまで)
body {
background-color : #cccccc;
color : #000000;
width : 400px;
}
div{
float:left;
width:200px;
}
<html>
<head>
<meta http-equiv="Content-Type: text/html" charset=Shift_JIS>
<title>code breaker</title>
<link type="text/css" rel="stylesheet" href="./codebreaker.css" />
<link type="image/gif" rel="shortcut icon" href="./codebreaker.favicon" />
<script type="text/javascript" src="./codebreaker.js"></script>
<script language="JavaScript">
<!---->
</script>
</head>
<body>
<div class="inputForm">
<form name="inputForm">
0 <input type="radio" name="radio1" value="0" checked="checked"> <!--(⇒略)これを4つぶん--> <br />
1 <input type="radio" name="radio1" value="1" checked="checked"> <br />
2 <input type="radio" name="radio1" value="2" checked="checked"> <br />
3 <input type="radio" name="radio1" value="3" checked="checked"> <br />
4 <input type="radio" name="radio1" value="4" checked="checked"> <br />
5 <input type="radio" name="radio1" value="5" checked="checked"> <br />
6 <input type="radio" name="radio1" value="6" checked="checked"> <br />
7 <input type="radio" name="radio1" value="7" checked="checked"> <br />
8 <input type="radio" name="radio1" value="8" checked="checked"> <br />
9 <input type="radio" name="radio1" value="9" checked="checked"> <br />
<input type="button" value="CHECK" onClick="alertCode()"> <br />
</form>
</div>
<div class="codeLog">
まだCSSは書いてない
</div>
</body>
</html>
function getRadioValue(radioObject){
for(i=0; i<radioObject.length; i++){
if(radioObject[i].checked){
return(radioObject[i].value);
}
}
return("(´・ω・`)");
}
function alertCode(){
var code;
code = getRadioValue(window.document.inputForm.radio1);
code += getRadioValue(window.document.inputForm.radio2);
code += getRadioValue(window.document.inputForm.radio3);
code += getRadioValue(window.document.inputForm.radio4);
alert(code);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment