将值从文本框传递到Google搜索栏 [英] Pass the value from textbox to google searchbar

查看:75
本文介绍了将值从文本框传递到Google搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我制作了一个Windows窗体应用.在Form1中,它包含一个文本框和一个按钮,而Form2中包含带有网址"www.google.com"的网络浏览器...我必须编写哪种类型的代码才能将值从form1的文本框传递到google的serchbar中form2 ???? ....(注意:当我运行我的应用程序时,form1将会出现....然后单击form1的按钮即可将form2贴上).

Hey I made one windows form app.; in taht form1 is contain one textbox and one button,and form2 contains webbrowser with url "www.google.com"...what type of code i have to write to pass the value from textbox of form1 to serchbar of google in opened in form2 ????....(Note: when I run my app. form1 will appeared....then form2 is appered on clicking of button of form1)

推荐答案

使用用于Google搜索的自定义网址启动应用程序中的默认浏览器.查看以下URL,您可以找到用于搜索代码项目"的模式

<a href="http://www.google.com/search?q=code+project&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a">http://www.google.com/search?q=code+project&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a</a>[<a href="http://www.google.com/search?q=code+project&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a" target="_blank" title="New Window">^</a>]

URL的简单形式是,

<a href="http://www.google.com/search?q=code+project">http://www.google.com/search?q=code+project</a>[<a href="http://www.google.com/search?q=code+project" target="_blank" title="New Window">^</a>]

您无需担心其他参数.
Kick off the default browser from your app, with the custom URL that used for the google search. Look at the following URL, you can find the pattern to search "code project"

<a href="http://www.google.com/search?q=code+project&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a">http://www.google.com/search?q=code+project&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a</a>[<a href="http://www.google.com/search?q=code+project&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a" target="_blank" title="New Window">^</a>]

The simple form of the URL is,

<a href="http://www.google.com/search?q=code+project">http://www.google.com/search?q=code+project</a>[<a href="http://www.google.com/search?q=code+project" target="_blank" title="New Window">^</a>]

You no need to worry about other parameters.


有时,很难找到嵌套在网页深处的正确元素.
简单的解决方案
遍历所有元素
如果元素是输入,则
用文本填充元素
如果
结束 下一个

提交表格
Sometimes it is hard to find the correct element nested deep in a webpage.
Simple solution
Iterate through all elements
If the element is an input then
fill the element with the text
end if
next

submit the form


这篇关于将值从文本框传递到Google搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆