0

in pset6 video,https://youtu.be/RQ2_TIXBo00 first David input search word, then after clicking 'submit' button the page jump to the google search result page. how this jumping implement?

3

When using a form, to accept the user's input, if you want to send this data to a new file or page, you use the action attribute. Here's an example:

<form action="https://www.google.com/search" method="get">
    <input name="q" type="text"/>
    <br/>
    <input type="submit" value="CS50 Search"/>
</form>

The action part is the target of your data. The method tells the browser in what way it will send the data. In that case the data is pasted on the url. So if you type in your browser https://www.google.com/search?q=cats it will search for cats. q is the "name" of the input as you can see and what you type inside the input is concatenated after the =. Keep watching the videos and you will get it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .