SharePoint Tricks - Survey
1. SharePoint 2010中,在Survey的问题框中输入HTML代码可以用于插入图片或者链接,具体方法为:
1.1 在问题框中输入html,
1.2 在New Form和Edit Form添加如下代码:
<script type="text/javascript" src="/sites/XXX/SiteAssets/jquery-1.11.0.min.js"></script> <script type="text/javascript"> $("#WebPartWPQ2 table[class='ms-formtable']").html($("#WebPartWPQ2 table[class='ms-formtable']").html().replace(/</g,"<").replace(/>/g,">")); </script>
1.3 在Display Form页面和Summary页面添加如下代码:
<script type="text/javascript" src="/sites/XXX/SiteAssets/jquery-1.11.0.min.js"></script> <script type="text/javascript"> $("#WebPartWPQ2").html($("#WebPartWPQ2").html().replace(/</g,"<").replace(/>/g,">")); </script>
2. SharePoint 2010中,在Survey中 增加Rating Scale Question的 问题区域宽度,添加背景,以及 增加问题之间的间隔:
//increase the width of Rating Scale Question $(document).ready(function(){ $("table[summary='Rating Scale Question']").each(function(){ $(this).find("td:first").css("width", "80%"); //添加背景色 $(this).find("tr").each(function(index, item){ if(index >= 3){ if(index%2 == 0){ $(item).css("background-color","#AAD7FF") } } }); }); });
<style> .ms-gridT1 { padding-top: 10px; padding-bottom: 10px; } </style>
效果如图:
3. SharePoint 2010中,为Survey增加显示框的宽度:
<style> #s4-workspace{ width:720px; } </style>
4.