Skip to content

Instantly share code, notes, and snippets.

@MladenMladenov
Last active January 28, 2016 13:55
Show Gist options
  • Save MladenMladenov/3b0726d294dd4b9877bc to your computer and use it in GitHub Desktop.
Save MladenMladenov/3b0726d294dd4b9877bc to your computer and use it in GitHub Desktop.
input{
border:none;
background: #cfff99;
width: 200px;
height:50px;
margin-top:20px;
font-size:30px;
}
input:active{
border:none;
box-shadow:black;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<input id="input" type="text" onChange="test();"/>
<input type="button" value="calculate" id="btn" onClick="calc(this)"/>
</body>
</html>
function test(){
var input = document.getElementById("input").value;
var intinput = parseInt(input,10);
console.log(intinput);
return intinput;
}
function calc(functionval){
var functionval = test();
if(isNaN(functionval)){
console.log("nan");
return;
}
var newvalue = functionval*5;
for (i = 1; i <= 5; i+=1){
console.log(newvalue);
}
}
///For circle area:
function test(){
var input = document.getElementById("input").value;
var intinput = parseInt(input,10);
return intinput;
}
function calc(functionval){
var functionval = test();
if(isNaN(functionval)){
console.log("nan");
return;
}
var newvalue = functionval;
/*for (i = 1; i <= 5; i+=1){ } */
console.log(Math.PI*Math.pow(newvalue,2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment