If you directly add \ n to multiple lines in javascript code:
Copy codeThe Code is as follows:
Alert ("first line \ n Second line ");
However, in java code, \ n cannot be used. \ n can only display multiple lines !!!
Copy codeThe Code is as follows:
String strTemp = "historical answer Report: \ n" + "you answered" + RdData. getCcnt () + "question \ n" + "you have" + RdData. getBcnt () + "No answer \ n" + "Incorrect answer" + RdData. getWcnt () + "question \ n ";
Out. print ("<script> alert ('" + strTemp + "'); window. location = 'index. jsp '</script> ");
First declare a String variable (note that the line feed is \ n !!!), Then put it in alert, and the page will jump to the home page.
This is the test result:
This is a special character code in javascript:
Copy codeThe Code is as follows:
Code Outputs
\ 'Single quote
\ "Double quote
\ Backslash
\ N new line
\ R carriage return
\ T tab
\ B backspace
\ F form feed