Addition value assignment operator (+ = ). Add the variable value and expression value and assign it to the variable.
It is often used when writing JavaScrpt. To be honest, I didn't quite understand it before. After reading a lot of code, it seems that a variable is too long to be written in several lines. But it solves my other problems.
In some cases, we need to use a series of HTML code as variables, while HTML always contains some quotation marks. For example
Copy codeThe Code is as follows:
Var Nameform = '<div id = "PointName"> <input id = "PointNameText" type = "text" size = 18 value = "Enter the landmark name" class = "inputField "onFocus =" this. value = null "onBlur =" this. value = 'Enter the landmark name' "/> </div> ';
At this time, you will find that the quotation marks are always bothering you. At this time, use '+ =' to solve the problem.
Copy codeThe Code is as follows:
Var Nameform = '<div id = "PointName"> <input id = "PointNameText" type = "text" size = 18 value = "Enter the landmark name" class = "inputField "onFocus =" this. value = null "onBlur =" this. value = ';
Nameform + = "'";
Nameform + = 'Enter the landmark name' here ';
Nameform + = "'";
Nameform + = '"/> </div> ';