zoukankan      html  css  js  c++  java
  • string.Format 里面包含 javascript方法参数的时候 单引号变成双引号的问题解决方法

    解决方法如下

    StringBuilder sb = new StringBuilder();
    
    var  str  =@"<label><input type='checkbox' onclick='adddelSingClass(""{0}"",""{1}"",""{2}"")'  name='JZ_CID' value={0}>&nbsp;{1}&nbsp;&nbsp;</label>";
     sb.Append(string.Format(str, temp.Classid, temp.Classname,"input"));
    
    也就是在你的字符串前面加 @ 符号,并且你的脚本的引号要变成2个双引号 ""        ,再来举一个列子
     
    sb.AppendFormat(@"<label><input type='checkbox' name='boxSend' onclick='adddelSingClass(""{0}"",""{1}"",""{2}"")' value={0}>&nbsp;{1}&nbsp;&nbsp;</label>", xgroup.Groupid, xgroup.Groupname, "input");
    
  • 相关阅读:
    栈和队列
    链表
    map
    二叉平衡树旋转
    二叉排序树详情
    红黑树详情
    查并集
    动态规划
    位操作
    字典树
  • 原文地址:https://www.cnblogs.com/joeylee/p/3186303.html
Copyright © 2011-2022 走看看