Created
March 14, 2012 23:48
-
-
Save shultzc/2040465 to your computer and use it in GitHub Desktop.
Demo of simple automatic form submission with JavaScript
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html version="-//W3C//DTD XHTML 1.1//EN" | |
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.w3.org/1999/xhtml | |
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"> | |
<head> | |
<script type="text/JavaScript"> | |
function submitForm(sender) { | |
sender.form.submit(); | |
} | |
</script> | |
<title>JavaScript Test</title> | |
</head> | |
<body> | |
<h1>Search-on-Click</h1> | |
<form id="MyForm" method="get" action="http://www.google.com/search"> | |
<div> | |
<input id="rad1" type="radio" name="q" value="Cats" onclick="submitForm(this)" /> | |
<label for="rad1">Cats</label> | |
<input id="rad2" type="radio" name="q" value="Dogs" onclick="submitForm(this)" /> | |
<label for="rad2">Dogs</label> | |
<input id="rad3" type="radio" name="q" value="Monkeys" onclick="submitForm(this)" /> | |
<label for="rad3">Monkeys</label> | |
</div> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment