js 拼接函数动作

    xiaoxiao2021-04-01  34

    op+='<a href="'+cggl.filePath+'"  title="下载"><b class="fa fa-download"></b></a>'; //    op+='<a  οnclick="hasPerm('+cggl.fileId+','+cggl.filePath+')"  title="下载"><b class="fa fa-download"></b></a>';          op+='<a  οnclick="hasPerm('+cggl.fileId+')"  title="下载"><b class="fa fa-download"></b></a>'; //    为什么不能用ccgl.filePath 和 ccgl作为hasPerm()的参数,原因是我这里op是写到页面的需要把对象cggl写到界面就成了[obj.obj]了,

    //    而filePath写到页面就成了 /upload/cggl/aa.rar ,所以不行,而href="cggl.filePath"可以是因为href标签的原因

    最后浏览器要解析op到前台 那前台就成了 <a onclik=hasPerm(5,"/upload/cggl/aa.rar") /><a>

    <a onclik=hasPerm([fileName,fileId,fileType]) /><a> 这个浏览器不认识 因此会造成报 xxx.ftl  第一行,xxx列错误

    cggl是个对象  private long fileId;     private String fileName;     private Integer fileType;     private String filePath;     private Long fileOwner;     private String filePerms;     private long parent;

    转载请注明原文地址: https://ju.6miu.com/read-665540.html

    最新回复(0)