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!