StillLearning
09-08-2006, 11:56 PM
I have been playing around with this working code:
<script language="JavaScript" type="text/javascript">
<!--
function search_google(){
window.open("http://www.google.com/search?q="+document.search.query.value);
}
//-->
</script>
<form name="search">
<input type="text" name="query" value="">
<input type="submit" value="Search Google" onClick="search_google()">
</form>
If I type for example 'feet' into the form it produces the query string http://www.google.com/search?q=feet which is fine but ....
I would like to modify the script to produce a query string like this http://www.google.com/search?q=feet+site%3Amyfootshop.com with the additional text provided by a hardcoded variable such as additionaltext=+site%3Amyfootshop.com
I know it must be quite easy but I am new to JavaScript.
Thank you for any help.
<script language="JavaScript" type="text/javascript">
<!--
function search_google(){
window.open("http://www.google.com/search?q="+document.search.query.value);
}
//-->
</script>
<form name="search">
<input type="text" name="query" value="">
<input type="submit" value="Search Google" onClick="search_google()">
</form>
If I type for example 'feet' into the form it produces the query string http://www.google.com/search?q=feet which is fine but ....
I would like to modify the script to produce a query string like this http://www.google.com/search?q=feet+site%3Amyfootshop.com with the additional text provided by a hardcoded variable such as additionaltext=+site%3Amyfootshop.com
I know it must be quite easy but I am new to JavaScript.
Thank you for any help.