(1) double quotation marks must be added to both sides of the string to indicate that this is a string. The double quotation marks on both sides of "abc", "def", and "gh" indicate that this is a string.
String a = "abc" + "abc ";
A = "abcabc ";
(2) Why do single quotes apply to single quotes? This is because if quotation marks are nested, the double quotation marks in the inner layer should be changed to single quotation marks.
Look at the example
<script type="text/javascript"> function abc() { window.open('WebForm1.aspx', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no'); } </script>
/// <Summary> /// a new window is displayed /// </summary> /// <param name = "pagePath"> page path </param> /// <param name = "winName"> New window name </param> /// <param name = "winWidth"> New window width </param> /// <param name =" winHeight "> New window height </param> public void openNewWin (string pagePath, string winName, int winWidth, int winHeight) {ClientScript. registerStartupScript (this. getType (), "", "<script type = 'text/javascript '> window. open ('"+ pagePath +"', '"+ winName +"', 'toolbar = no, menubar = no, titlebar = no, directories = no, resizable = no, scroll = yes, status = no, fullscreen = no, center = yes, width = "+ winWidth +", height = "+ winHeight + "'); </script> "); return ;}
By comparing two pieces of code, you can understand the nesting of double quotation marks and single quotation marks.
Background writing
"<SCRIPT type = 'text/JavaScript '> window. open ('"+ pagepath +"', '"+ winname +"', 'toolbar = No, menubar = No, titlebar = No, directories = No, resizable = No, scroll = Yes, status = No, fullscreen = No, center = Yes, width = "+ winwidth +", Height = "+ winheight +" '); </SCRIPT>"
Frontend statement
<SCRIPT type = "text/JavaScript">
Window. open ('webform1. aspx ', 'newwindow', 'height = 100, width = 400, Top = 0, Left = 0, toolbar = No, menubar = No, scrollbars = No, resizable = No, location = No, status = no ');
</SCRIPT>
1. Double quotation marks in double quotation marks, which must be expressed in single quotation marks
2. The parameter string '"+ pagepath +"' in double quotes. Other types are "+ winwidth + ".