如何在Javascript中ESCAPE"逗号"

Nic*_*ahn 1 javascript asp.net

EDIT1:

btnDelete.Attributes.Add("onclick", String.Format(@"return DeleteRow('{0}',{1},{2},{3});", e.Row.ClientID, e.Row.RowIndex, DataBinder.Eval(e.Row.DataItem, "Id"), "'" + DataBinder.Eval(e.Row.DataItem, "Name") + "'"));
Run Code Online (Sandbox Code Playgroud)

编辑:

我收到此错误:

消息:未终止的字符串常量

我正在传递代码背后的值,我的一些文字有点像这样:

Foo3, In.c

   //javascript
    function DeleteRow(rowId, rowIdx, Id, Name) {         
        var textForMessage = "return confirm('Are you sure you want to delete this record with the name: \n{0} \n{1}');";
        //removed code...  
       return result;
    }
Run Code Online (Sandbox Code Playgroud)

Que*_*tin 10

没做什么.逗号在JavaScript字符串中没有特殊含义.