在JavaScript文件里嵌入大量字符串常量是经常遇到的事。有时为了省事,就把一些界面的HTML和CSS直接写在JS文件里。数量少还好,多的话就密密麻麻的一坨文字,讲究美观的文艺青年们,会用大量的字符连接符号甚至加上缩进,强制换成好几行。例如:
var html =
'<div>' +
'<p>Hello</p>' +
'<p>World'</p>' +
'</div>';
这还好,要是字符串里有不少双引号单引号,那就更麻烦了,各种转义字符看的眼花缭乱。
其实有个不怎么起眼的小技巧,就能解决这个问题。大家总认为字符串必须在”R… Read More
测试DEMO
I am currently working on a large project and part of the project is to send simple text message notices using PHP. Our client had looked into a number of expensive services to send simple SMS messages but most were cost prohibitive for a start-up venture.
As usual, I was not satisfied paying for something that