Use JavaScript to submit form data in the image hotspot button

Source: Internet
Author: User

 

1,First, add an id = form1 to the form (ID can be set by name at will, but it is important that this name 1 is used when the image button is used ), and enter the name of the webpage to be sent: put_in.asp (this webpage is the one you want to receive the previous message sent from this webpage)
As follows:

<Form name = "form1" id = "form1" method = "Post" Action = "put_in.asp">

 

2,When you need to connect to a button hotspot and submit the content on this page to the receiving webpage (put_in.asp), draw a hotspot on the image first, then rewrite the hotspot href = "" tag:

<Area shape = "rect" coords = "30,14, 100,37" href = "javascript: form1.submit ();">

Here (form1) is the form ID.

3,If your image is not a hotspot, you can connect to the specified webpage and correctly send the information you need, insert an image into a link and add onclick = "" (click the event) to the Image Tag. Then rewrite it:

<A href = "#"> </a>

You can.

4,The following describes how to reset a button:
Use Image hotspot href = "javascript: form1.reset ();"
Click Event onclick = "javascript: form1.reset ();"

Now, you don't need the ugly form button to create a webpage.

Netken

Related Article

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.