Four forms of parameter passing-----URL, hyperlink, Js,form form

Source: Internet
Author: User

When to use GET, check, delete,

When to use post, add, change (Special column: Login with post, because the user name and password can not be displayed on the URL)

4 ways to get the parameters

[HTML]View Plaincopy
  1. <HTML xmlns="http://www.w3.org/1999/xhtml">
  2. <head>
  3. <Meta http-equiv= "content-type" content= "text/html; Charset=utf-8 "/>
  4. <title></title>
  5. <script type="Text/javascript">
  6. function Go () {
  7. window.location.href="localhost:21811/handler1.ashx?id=1&name= ' abc '"
  8. }
  9. </Script>
  10. </head>
  11. <body>
  12. <!--//parameter delivery in several forms-
  13. <!--First: Add parameters directly after the URL:-->
  14. Localhost:21811/handler1.ashx? id=1&name="abc"
  15. <!--second: Pass parameters by hyperlink: When you click on the hyperlink, you will first jump to the Localhost:21811/handler1.ashx page, and then pass the ID and name two parameters past--
  16. <a href="localhost:21811/handler1.ashx?id=1&name= ' abc '"> Hyperlink pass parameter </a ></body>
  17. <!--third: Pass the JS method: The user clicks on this button, triggers the onclick event, executes the Go () method, jumps to localhost:21811/ HANDLER1.ASHX page, pass ID, and name two parameters past---
  18. <input type="button" onclick="Go ()" value="pass the parameter through the JS method" />
  19. <!--Fourth: Pass through form forms --
  20. <form action= "handler1.ashx" method="get"><!--Note that the connection inside the action cannot have parameters-- >
  21. <input type="text" name= "id" value="3" />
  22. <input type="text" name="name" value="abc" />
  23. <input type="Submit" value= "Pass parameters"/>
  24. </form>
  25. </body>
  26. </html>

Four forms of parameter passing-----URL, hyperlink, Js,form form

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.