Usage of double quotation marks and single quotation marks in asp.net

Source: Internet
Author: User

 

(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 + ".

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.