源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

javascript实现存储hmtl字符串示例

  • 时间:2020-11-08 11:14 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:javascript实现存储hmtl字符串示例
[u]复制代码[/u] 代码如下:
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); }  function fn(){  /*<table> <tr> <td>用户名</td> <td>密码</td> </tr> <tr> <td style="widht:20px;">@name</td> <td>zf123456</td> </tr> </table>*/ } varstr_table=fn.heredoc(); console.log(str_table);
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部