javascript - easyui相关, formatter函数中js的slice和substr方法失效?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style type="text/css">
</style>
</head>
<body>
<table class="easyui-datagrid" style="width:1350px;height:600px;text-align: center;"
url="data/progress.json"
title="员工管理" toolbar="#tb"
singleSelect="true" fitColumns="true" pagination="true">
<thead>
<tr>
*<th data-options="field:'img',width:120,align:'center',formatter:imgFormatter">id</th>*
</tr>
</thead>
</table>
<script type="text/javascript">
function imgFormatter (v) {
**var v1= v.substr(4,-4);
return '<img src='+v+'/>'+'<span class="name">'+ v1+'</span>';**
}
</script>
</body>
</html>
在表格中插入图片和文字用formatter函数,图片可以显示,但截取文字时,js的slice和substr方法失效?