sharepoint 2013 自定义列表查看页面附件打开新页面方法 dispform attachments open new page

来源:互联网 发布:如何设置淘宝宝贝模板 编辑:程序博客网 时间:2024/04/29 04:13

我们在sharepoint的列表中,打开某一条数据,如果那条数据有附件,打开附件的时候,总是会把当前的页面给替换掉。如何在点击附件的时候,打开新页面,可以用一下一段脚本来处理。

<script>

$(document).ready(function () {

   if ($("#idAttachmentsTable") !=null) {

       $('#idAttachmentsTabletbody tr td').each(function () {

           if(window.location.href.indexOf('DispForm.aspx') > -1) {

               var href = $(this).find('a');

               href.removeAttr("onclick");

               href.attr("target","_blank");

           }

       });

   }

});

</script>

 

2 0