Describe your problem
I would like to do a search box similar to the following, when the user enters a value, click on the options above will jump to different links,
Such as
For example, I enter QQ,
Click on the "News" above, will jump to NEWS.SOGOU.COM/?KW=QQ
Or click on the "" above and jump to HWEIXIN.SOGOU.COM/?KW=QQ
Or click on "Ask" above. Will jump to WENWEN.SOGOU.COM/?CID=QQ
.........
When the user enters a value, click on the option above to jump to a different link, with javascript+html how to write. Trouble with complete code. Thank you. I do the art,
Reply content:
Describe your problem
I would like to do a search box similar to the following, when the user enters a value, click on the options above will jump to different links,
Such as
For example, I enter QQ,
Click on the "News" above, will jump to NEWS.SOGOU.COM/?KW=QQ
Or click on the "" above and jump to HWEIXIN.SOGOU.COM/?KW=QQ
Or click on "Ask" above. Will jump to WENWEN.SOGOU.COM/?CID=QQ
.........
When the user enters a value, click on the option above to jump to a different link, with javascript+html how to write. Trouble with complete code. Thank you. I do the art,
window.location.href = "Your url"
JS can implement dynamic adjustment form
of the action value, HTML can be as follows:
新闻 网页
The navigation menu here can also be generated dynamically, that is, the use of variable definitions in the JS script, and then JS to output. The script assumes that writing is used jQuery
.
Next to my idea, input box onkeyup event, get input box value, then event delegate, change href to original address + keyword
The demo is as follows:
JS Bin新闻搜索
Online demo point here, about the URL after the redirection of the construction rules, the main topic to look at, each site is not the same