日期:2014-05-16  浏览次数:20452 次

js 引号的替换
怎么把\"size\":20.0}],\"data\": 中的\" 替换成"?
------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

</body>
<script>
var str='{\"spread\":{\"version\":\"1.0\",\"sheetCount\":1,\"startSheetIndex\":0,\"sheets\":{\"工作表1\":{\"name\":\"工作表1\",\"defaults\":{\"rowHeight\":20.0,\"colWidth\":80.0,\"colHeaderRowHeight\":20.0,\"rowHeaderColWidth\":40.0},\"rowCount\":18,\"columnCount\":7,\"columns\":[],\"rows\":[null,null,null,null,{\"size\":20.0},null,null,null,null,null,null,{\"size\":20.0}],\"data\":{\"rowCount\":18,\"colCount\":7,\"name\":\"工作表1\",\"dataTable\":{\"4\":{\"0\":{\"value\":12.0,\"style\":{\"foreColor\":\"Text 1 0\",\"hAlign\":3,\"vAlign\":2,\"font\":\"normal normal 16px Arial\",\"themeFont\":\"Body\",\"locked\":true,\"wordWrap\":false}}},\"11\":{\"0\":{\"value\":12.0,\"formula\":\"SUM(A1:A11)\",\"style\":{\"foreColor\":\"Text 1 0\",\"hAlign\":3,\"vAlign\":2,\"font\":\"normal normal 16px Arial\",\"themeFont\":\"Body\",\"locked\":true,\"wordWrap\":false}}}},\"_rowDataArray\":[],\"_columnDataArray\":[],\"_defaultDataNode\":{\"style\":{\"foreColor\":\"Text 1 0\",\"hAlign\":3,\"vAlign\":2,\"font\":\"normal normal 16px Arial\",\"themeFont\":\"Body\",\"locked\":true,\"wordWrap\":false}}},\"sparklineGroupManager\":{\"groups\":[]},\"activeRow\":17,\"activeCol\":6,\"selections\":{\"0\":{\"row\":17,\"col\":6,\"rowCount\":1,\"colCount\":1},\"length\":1,\"activeSelectedRangeIndex\":0},\"selectionBackColor\":\"rgba(180,180,200,0.235294117647059)\",\"selectionBorderColor\":\"rgba(0,0,0,0.862745098039216)\",\"gridline\":{\"color\":\"rgba(208,215,229,1)\",\"showHorizontalGridline\":true,\"showVerticalGridline\":true},\"theme\":{\"_name\":\"Office\",\"_themeColor\":{\"_name\":\"办公室\",\"_colorList\":[{\"a\":255,\"r\":255,\"g\":255,\"b\":255},{\"a\":255,\"r\":238,\"g\":236,\"b\":225},{\"a\":255,\"r\":0,\"g\":0,\"b\":0},{\"a\":255,\"r\":31,\"g\":73,\"b\":125},{\"a\":255,\"r\":79,\"g\":129,\"b\":189},{\"a\":255,\"r\":192,\"g\":80,\"b\":77},{\"a\":255,\"r\":155,\"g\":187,\"b\":89},{\"a\":255,\"r\":128,\"g\":100,\"b\":162},{\"a\":255,\"r\":75,\"g\":172,\"b\":198},{\"a\":255,\"r\":247,\"g\":150,\"b\":70},{\"a\":255,\"r\":0,\"g\":0,\"b\":255},{\"a\":255,\"r\":128,\"g\":0,\"b\":128}]},\"_headingFont\":\"Cambria\",\"_bodyFont\":\"Calibri\"},\"conditionalFormats\":{},\"rowHeaderData\":{\"rowCount\":18,\"colCount\":1,\"name\":\"工作表1\",\"dataTable\":{},\"_rowDataArray\":[],\"_columnDataArray\":[],\"_defaultDataNode\":{\"style\":{\"hAlign\":1,\"vAlign\":1,\"font\":\"16px Arial\"}}},\"colHeaderData\":{\"rowCount\":1,\"colCount\":7,\"name\":\"工作表1\",\"dataTable\":{},\"_rowDataArray\":[],\"_columnDataArray\":[],\"_defaultDataNode\":{\"style\":{\"hAlign\":1,\"vAlign\":1,\"font\":\"16px Arial\"}}},\"rowHeaderColInfos\":[],\"colHeaderRowInfos\":[],\"tableManager\":{},\"rowRangeGroup\":{\"itemsCount\":18},\"colRangeGroup\":{\"itemsCount\":7},\"rowFilter\":null,\"allowCellOverflow\":true,\"_index\":0}}}}';

document.body.innerHTML=str.replace(/\\"/,'"');
</script>
</html>