Created
May 19, 2015 05:33
-
-
Save Pittan/3d81c244ebc203c51685 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>ほげほげ</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> | |
</head> | |
<style> | |
body{ | |
padding-top:60px; | |
} | |
.panel{ | |
max-width:600px; | |
margin-left:auto; | |
margin-right:auto; | |
} | |
.jumbotron{ | |
max-width:600px; | |
margin-left:auto; | |
margin-right:auto; | |
} | |
</style> | |
<body> | |
<div class="container"> | |
<div class="panel panel-default"> | |
<div class="panel-heading">権限</div> | |
<div class="panel-body"> | |
<form id="permisson" class="form" onChange="calcPermission()"> | |
<table class="table"> | |
<tr><th>管理者</th><th>グループ</th><th>その他</th></tr> | |
<tr><td><input type="checkbox" id="readOwner"> r(読込)</td><td><input type="checkbox" id="readGroup"> r(読込)</td><td><input type="checkbox" id="readOthers"> r(読込)</td></tr> | |
<tr><td><input type="checkbox" id="writeOwner"> w(書込)</td><td><input type="checkbox" id="writeGroup"> w(書込)</td><td><input type="checkbox" id="writeOthers"> w(書込)</td></tr> | |
<tr><td><input type="checkbox" id="exeOwner"> x(実行)</td><td><input type="checkbox" id="exeGroup"> x(実行)</td><td><input type="checkbox" id="exeOthers"> x(実行)</td></tr> | |
</table> | |
</form> | |
</div> | |
</div> | |
<div class="jumbotron"> | |
<h1 id="permissionInt">000</h1> | |
</div> | |
</div> | |
<script> | |
function calcPermission(){ | |
var permission = 0; | |
if($('#readOwner').prop('checked')){ | |
permission += 400; | |
} | |
if($('#writeOwner').prop('checked')){ | |
permission += 200; | |
} | |
if($('#exeOwner').prop('checked')){ | |
permission += 100; | |
} | |
if($('#readGroup').prop('checked')){ | |
permission += 40; | |
} | |
if($('#writeGroup').prop('checked')){ | |
permission += 20; | |
} | |
if($('#exeGroup').prop('checked')){ | |
permission += 10; | |
} | |
if($('#readOthers').prop('checked')){ | |
permission += 4; | |
} | |
if($('#writeOthers').prop('checked')){ | |
permission += 2; | |
} | |
if($('#exeOthers').prop('checked')){ | |
permission += 1; | |
} | |
showPermission(permission); | |
} | |
function showPermission(permission){ | |
var str = String(permission); | |
while (str.length < 3) { | |
str = "0"+str; | |
} | |
$('#permissionInt').text(str); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment