js '' "" The nest

1, I need to splice a string, but which contains a double quote inside single quotes, double quotes and single quotes containing variable then we can think of to use HTML special character escape

2, following splicing

return '<input type="text" name="input_grjcjs"'+
                ' onchange="setValueChange(this,&quot;'+grzh+'&quot;,'+r.ROW_ID+','+r.GRZHZT+','+r.GRYJCE+','+r.DWYJCE+
                ','+r.YJCEHJ+','+tw+')" grjcbl="'+r.GRJCBL+'" dwjcbl="'+r.DWJCBL+'" value="'+data+'" '+ dis+
                ' class="form-control">';

3, HTML special character escape table: http://tool.oschina.net/commons?type=2

Guess you like

Origin www.cnblogs.com/ywf520/p/11411896.html