Javascript-Modify the submit button of the baidu search form (that is, the "Baidu" button)

Source: Internet
Author: User
Search. php can use file_get_contents to get & quot; www. baidu. coms? Wd $ keyword & quot; where $ keyword comes from the parameter wdsearch. phpfile_get_contents of search. php, and some replacement operations are performed. Finally, the echo content is j...

Use search. phpfile_get_contentsObtain"http://www.baidu.com/s?wd=$keyword"
Where$keywordWd parameter from search. php

Search. phpfile_get_contentsThen perform some replacement operations, and finally echo the content
The next step is the use of jQuery, removing some Baidu elements.

The next question is how to change the action path of the "Baidu click" submit button next to the baidu search box

There is a submit in this form. I changed the action attribute of the form to which it belongs, which has no effect.

I hope the behavior is'search.php?wd='+$('#kw').val()Instead'/s?wd='+$('#kw').val()

I also analyzed Baidu's script... it's absolutely messy. Please advise.

Reply content:

Use search. phpfile_get_contentsObtain"http://www.baidu.com/s?wd=$keyword"
Where$keywordWd parameter from search. php

Search. phpfile_get_contentsThen perform some replacement operations, and finally echo the content
The next step is the use of jQuery, removing some Baidu elements.

The next question is how to change the action path of the "Baidu click" submit button next to the baidu search box

There is a submit in this form. I changed the action attribute of the form to which it belongs, which has no effect.

I hope the behavior is'search.php?wd='+$('#kw').val()Instead'/s?wd='+$('#kw').val()

I also analyzed Baidu's script... it's absolutely messy. Please advise.

Check whether the form is submitted using js.

    C.delegate("form", "submit",    function() {        C.find("iframe").on("load",        function() {            E()        });        setTimeout(E, 1000)    })

I found this code when analyzing Baidu's nu_instant_search.js, but I still cannot find the E function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.