Skip to content

Instantly share code, notes, and snippets.

@objectoriented
Last active September 25, 2015 12:37
Show Gist options
  • Save objectoriented/922740 to your computer and use it in GitHub Desktop.
Save objectoriented/922740 to your computer and use it in GitHub Desktop.
Submit a SearchSpring search query to a search results page on a .NET page with a monolithic form
<script type="text/javascript">
function redirectToSearchSpring() {
var evt = window.event ? window.event : null;
if (evt) {
var key = evt.charCode ? evt.charCode : (evt.keyCode ? evt.keyCode : (evt.which ? evt.which : 0));
if (key == "13") {
window.location.href = 'http://www.example.com/search.html?q=' + encodeUriComponent(document.getElementById('search_query_input').value);
return false;
}
}
}
</script>
<input name="q" type="text" id="search_query_input" class="SearchBox searchspring-query" size="10" autocomplete="off" onkeypress="redirectToSearchSpring();">
<input type="image" class="SearchButton" align="top" src="go.gif" style="border-width:0px;" onclick="window.location.href='/search.html?q=' + encodeURIComponent(form.q.value); return false;">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment