JavaScript-<form> button,submit,reset including <form> own Name property is not all that useless?

Source: Internet
Author: User
Keywords Html php javascript
I was scattered to learn, nor did the project, that is, every learning an object, a function, I do the experiment, there are related things, I put a similar to the bait

I know

The name in is really useful and can be used to pass values to PHP, but


 
  
  
   
 
  

Is there no other use in the name attribute in addition to the Document.getelementsbyname ("") [0] and the $ ("[name=]") of jQuery in JavaScript?
As long as I do not use JS, then I do not have to write the Name property, right?

And there's this.

What's the use of value in? They are not a Boolean value, the choice is true, not selected false? With checked can determine, why there is a value, this how to pass the server?

Reply content:

I was scattered to learn, nor did the project, that is, every learning an object, a function, I do the experiment, there are related things, I put a similar to the bait

I know

The name in is really useful and can be used to pass values to PHP, but

Is there no other use in the name attribute in addition to the Document.getelementsbyname ("") [0] and the $ ("[name=]") of jQuery in JavaScript?
As long as I do not use JS, then I do not have to write the Name property, right?

And there's this.

What's the use of value in? They are not a Boolean value, the choice is true, not selected false? With checked can determine, why there is a value, this how to pass the server?

    1. When the button type= "Submit", there is a name, and method= "get", is committed, type= "button | Reset "No matter if name is not

2.type= "Radio" value is passed to the back end, checked can only JS to judge, as long as there is a name, will naturally put the selected value to the backend

You look like a novice!
I'm going to try to give you the answer.
1. Does the button,submit,reset include its own name attribute?
It's no use, no matter what you get by $_get and $_post, you get the value, you get the button value of the foreground, the value of the submit and reset are useless, the so-called value is the text displayed on the button, personally, Name just does some pre-JS and jquery operations.
2.

This is useful, set the radio button's Value property, the two values are different, such as: a set for the male, a set for the female, you back end is to get after the judgment of the OH. You can do some logical processing based on value that is worth doing differently.
I don't know what I'm talking about, read the manual.

  • 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.