Skip to content

Instantly share code, notes, and snippets.

@danspndl
Created September 29, 2015 16:03
Show Gist options
  • Save danspndl/a5ca14fd43926ffff7c6 to your computer and use it in GitHub Desktop.
Save danspndl/a5ca14fd43926ffff7c6 to your computer and use it in GitHub Desktop.
Obtaining form values
<!DOCTYPE html>
<html>
<head>
<title>Obtaining form values</title>
<meta charset="UTF-8">
</head>
<body>
<form action="" id="input" >
<p>
<label for='a'>a=</label>
<input type="text" id="aSide" name="a" value="1" />
</p>
<p>
<label for='b'>b=</label>
<input type="text" id="b" name="b" value="1" />
</p>
<p>
<label for='c'>c=</label>
<input type="text" id="c" name="c" value="1" />
</p>
<input type="button" onclick="send()" value="Submit">
</form>
<script>
function send() {
// Obtaining form values
var a = input.elements["a"].value;
var b = input.elements["b"].value;
var c = input.elements["c"].value;
// Debug
console.log("a= "+a);
console.log("b= "+b);
console.log("c= "+c);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment