How to solve the single and double citation in JS Conflict, think of the following code:
The code is as follows
html + + ' <a onclick= ' return removeopencss (' +e.point.lng+e.point.lat+ ') ' > Cancel </a> ';
This is the code in JS, if this is written here, will be prompted JS error, because the Removeopencss method in the parameters are not single or double lead, if here, this writing:
The code is as follows
html + + ' <a onclick= ' return removeopencss ("' +e.point.lng+e.point.lat+ '") "> Cancel </a>";
Direct error, because there is a single and dual-lead conflict, so I only through this solution:
The code is as follows
html = ' <a onclick= ' return removeopencss (" ' +e.point.lng+e.point.lat+ ' ") ' > Cancel </a> ';
In JS when nested two-layer double quotes are generally error
The following methods can be used to resolve
Replace the inner single quotation mark with the '
Double quotation marks replaced by "
As the following example is OK.
The code is as follows
<title>
JS single quotation mark double quotation mark problem
</title>
<script>
function ShowMsg (s)
{
alert (s);
}
</script>
<body>
<input type= "button" value= "click Me" onclick= "ShowMsg" ( "' " Fsdfds ') "/>
<input type=" text "id=" txtname "name=" txtname "value=" ' " Fsdfds "/>
</body>