描述:后台输出js到前台,如
|
|
<script type="text/javascript"> |
|
//<![CDATA[ |
|
|
|
var aStepData = new Array(); |
|
with (aStepData) { |
|
push([3, 1,'./l.txt']); |
|
push([6, 2,'3' 4'\'5 " ''']); |
|
|
|
}; |
|
//]]> |
|
</script> |
|
|
由于js中包含单引号,导致js错误,因此需输出转义的单引号。
解决:后台输出js时替换单引号为 转移字符+单引号 ,如
select replace(filepath,'''','\\\''') as filepath
|
|
<script type="text/javascript"> |
|
//<![CDATA[ |
|
|
|
var aStepData = new Array(); |
|
with (aStepData) { |
|
push([3, 1,'./text']); |
|
push([6, 2,'3\' 4\' \'5 " \'\'']); |
|
|
|
}; |
|
//]]> |
|
</script> |
|
|
|
|
<script type="text/javascript"> |
|
//<![CDATA[ |
|
|
|
var aStepData = new Array(); |
|
with (aStepData) { |
|
push([3, 1,'./learn_files/CRM/报告模板/CRM-L2 带教实习表格/L2_brady_learn.txt']); |
|
push([6, 2,'3\' 4\' \'5 " \'\'']); |
|
|
|
}; |
|
//]]> |
|
</script> |
|
|