Creating a Google search form that only returns C# results
I know that I can create a google开发者_C百科 search box on my personal homepage using something like this (very basic code)
<form method="get" action="http://www.google.com/search">
<input type="text" name="q" />
<input type="submit" value="Google Search" />
</form>
Is it possible to change this to only return results containing C#.
If I enter stringbuilder, the above code submits http://www.google.com/search?q=stringbuilder
whereas I want is http://www.google.com/search?q=c%23+stringbuilder
Google supports multiple q
arguments. You can generate URLs like this: http://www.google.com/search?q=text1&q=text2. In your case, add a hidden input:
<input type="hidden" name="q" value="C#" />
精彩评论