JavaScript实现存储HTML字符串示例
我是搞PHP的,让我想起了<<<语法(heredoc和nowdoc),那么就为他命名heredoc吧。 代码如下: Function.prototype.heredoc = function(){ // 利用 function 的注释来存储字符串,而且无需转义。 var _str = this.toString(), s_pos = _str.indexOf(“/*”)+2, e_pos = _str.lastIndexOf(“*/”); return (s_pos<0 || e_pos<0) ? “” : _str.substring(s_pos, e_pos
下载地址
用户评论