开发者

Creating a Google search form that only returns C# results

开发者 https://www.devze.com 2023-01-26 06:13 出处:网络
I know that I can create a google开发者_C百科 search box on my personal homepage using something like this (very basic code)

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#" />
0

精彩评论

暂无评论...
验证码 换一张
取 消