About the difference between "xxx" (double quotes) and (single quotes) ' xxx ' in HTML5 code, talk about my experience!

Source: Internet
Author: User
Tags italic font

Recently in the learning time to see someone asked "find" and "find" the difference, found a lot of people say no difference, purely personal hobbies!

So I was curious to experiment, found a different result, through comparative analysis found "and" "(single quotes, double quotes), or there is a great difference!


Recommendation:<!--************ to prevent quotes from matching errors; single and double quotation marks cross-use *******************-->

When using the HTML onclick event attribute, it is wrong to use single quotation marks/double quotes, such as:

<!--************ to prevent quotes from matching errors; it is best to cross-use single and double quotes *******************--><InputType="Button"Value="Save"onclick="Savelocalstorage ("Form1 ")"/>
<!--Double quote Matching**********Error-
<Inputtype= "button "value=" Save "onclick=" Span style= "font-style:italic;" >savelocalstorage ( ' Form1 ') "/>
single and double quotes mixed *********** correct -->

Here is the test case source code:
CDN Accelerator Link: Http://pan.baidu.com/s/1eQ0I73G Password: yg3r
<! DOCTYPEHtml>
<Htmllang="EN">
<Head>
<Metacharset="UTF-8">
<ScriptSrc=".. /js/local_storage.js "Type="Text/javascript"></Script>
<Title>local Storage</Title>
<StyleType="Text/css">
body{
Background-color:Chartreuse;
}
</Style>
</Head>
<Body>
<DivId="Div1">
<H1Id="MSG"></H1>
<FormId="Form1">
<Label>name:</Label>
<InputId="Name"Type="Text"Name="Name"Required="Required"/><Br/>
<Label>email:</Label>
<InputId="Email"Type="Email"Name="Email"Required="Required"/><Br/>
<Label>tel:</Label>
<InputId="Tel"Type="Tel"Name="Tel"Required="Required"/><Br/>
<Label>male:</Label>
<InputId="Gender1"Type="Radio"Name="Gender"Value="Male"/><Br/>
<Label>female:</Label>
<InputId="Gender2"Type="Radio"Name="Gender"Value="Female"/><Br/>
</Form>
<!--************To prevent quotation marks from matching errors, single and double quotation marks cross-use*******************
<input type= "button" value= "Save" onclick= "Savelocalstorage (" Form1 ")"/>
-
<InputType="Button"Value="Save"onclick="Savelocalstorage (' Form1 ')"/>
<Inputtype= "button "value=" Save "onclick=" Span style= "font-style:italic;" >savelocalstorage ( email ') "/>
<input type=value= "show" onclick= "Showlocalstorage (' msg ')"/></DIV></BODY></HTML>
                     

About the difference between "xxx" (double quotes) and (single quotes) ' xxx ' in HTML5 code, talk about my experience!

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.