-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from nhsprite/master
Merge blog & calculator from nihao
- Loading branch information
Showing
5 changed files
with
178 additions
and
45 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,47 @@ | ||
div#container{width:1300px} | ||
div#header {background-color:#99bbbb;text-align: center;} | ||
div#menu1 {background-color:#ffff99;height:200px;width:300px;float:left;} | ||
div#content1 {background-color:#FFE66F;height:200px;width:1000px;float:left;} | ||
div#menu2 {background-color:#ffff99;height:200px;width:300px;float:left;} | ||
div#content2 {background-color:#FFE66F;height:200px;width:1000px;float:left;} | ||
div#footer {background-color:#99bbbb;clear:both;text-align:center;} | ||
h1 {margin-bottom:0;} | ||
h2 {margin-bottom:1;font-size:18px;} | ||
ul {margin:10;} | ||
li {list-style:none;} | ||
body { | ||
height: 100%; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
.container { | ||
width:100%; | ||
height:100%; | ||
} | ||
.header { | ||
position: relative; | ||
width: 100%; | ||
height: 40px; | ||
line-height: 20px; | ||
top: 0px; | ||
} | ||
|
||
.content { | ||
text-align: left; | ||
height:100%; | ||
width:100%; | ||
float:left; | ||
} | ||
.footer { | ||
position: absolute; | ||
bottom: 0; | ||
width: 100%; | ||
height: 20px; | ||
background-color: #d93a49; | ||
clear:both; | ||
text-align:center; | ||
} | ||
h1 { | ||
margin-left: 1cm; | ||
margin-bottom:0; | ||
} | ||
h2 { | ||
margin-left: 1cm; | ||
margin-bottom:0; | ||
font-size:18px; | ||
} | ||
ul { | ||
margin:0; | ||
} | ||
li { | ||
list-style:none; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
body{ | ||
background-color: #ffffff; | ||
} | ||
.container{ | ||
margin-left: auto; | ||
margin-right: auto; | ||
width: 400px; | ||
height: 430px; | ||
line-height: 20px; | ||
border-style: solid; | ||
border-color: red; | ||
} | ||
|
||
#ButtonPercent{ | ||
height: 50px; | ||
width: 150px; | ||
margin-left: 10px; | ||
margin-top: 20px; | ||
} | ||
#ButtonAC{ | ||
height: 50px; | ||
width: 150px; | ||
margin-left: 65px; | ||
margin-top: 20px; | ||
} | ||
|
||
button{ | ||
height: 50px; | ||
width: 80px; | ||
margin-left: 10px; | ||
margin-top: 20px; | ||
outline-color: #EE4000; | ||
background-color: #CDCD00; | ||
} | ||
|
||
h1{ | ||
text-align: center; | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="cal.css"> | ||
<script src="cal.js"></script> | ||
<title>calculator</title> | ||
</head> | ||
<body> | ||
<form> | ||
<h1>CALCULATOR</h1> | ||
<hr color="red";> | ||
<div class="container"> | ||
<input type="text" name="expr" style="width:396px; height:60px; background:#00FFFF" /> | ||
<button type="button" id="ButtonPercent" onclick="percent(this.form)">%</button> | ||
<button id="ButtonAC" value="AC" onclick="form.reset()">AC</button> | ||
<div> | ||
<button type="button" value="7" onclick="enter(this.form,seven)">7</button> | ||
<button type="button" value="8" onclick="enter(this.form,eight)">8</button> | ||
<button type="button" value="9" onclick="enter(this.form,nine)">9</button> | ||
<button type="button" value="/" onclick="enter(this.form,divide)">/</button> | ||
</div> | ||
<div> | ||
<button type="button" value="4" onclick="enter(this.form,four)">4</button> | ||
<button type="button" value="5" onclick="enter(this.form,five)">5</button> | ||
<button type="button" value="6" onclick="enter(this.form,six)">6</button> | ||
<button type="button" value="*" onclick="enter(this.form,multiply)">*</button> | ||
</div> | ||
<div> | ||
<button type="button" value="1" onclick="enter(this.form,one)">1</button> | ||
<button type="button" value="2" onclick="enter(this.form,two)">2</button> | ||
<button type="button" value="3" onclick="enter(this.form,three)">3</button> | ||
<button type="button" value="-" onclick="enter(this.form,minus)">-</button> | ||
</div> | ||
<div> | ||
<button type="button" value="0" onclick="enter(this.form,zero)">0</button> | ||
<button type="button" value="." onclick="enter(this.form,point)"><b>.</b></button> | ||
<button type="button" value="=" onclick="compute(this.form)">=</button> | ||
<button type="button" value="+" onclick="enter(this.form,plus)">+</button> | ||
</div> | ||
</form> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var one = "1" | ||
var two = '2' | ||
var three = '3' | ||
var four = '4' | ||
var five = '5' | ||
var six = '6' | ||
var seven = '7' | ||
var eight = '8' | ||
var nine = '9' | ||
var zero = '0' | ||
var plus = '+' | ||
var minus = '-' | ||
var multiply = '*' | ||
var divide = '/' | ||
var point = '.' | ||
|
||
function compute(obj){ | ||
obj.expr.value = eval(obj.expr.value) | ||
} | ||
|
||
function enter(obj,string){ | ||
obj.expr.value += string | ||
} | ||
|
||
function percent(obj){ | ||
obj.expr.value = eval(obj.expr.value+'/100') | ||
} |