我有一个附加到CEWP的脚本,它只在我处于编辑模式时执行,在保存页面时什么也不做.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
function openDialogBox(Url)
{
var ModalDialogOptions = { url:Url, width: 600, height: 500, showClose: true, allowMaximize: true};
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', ModalDialogOptions);
}
(function($){
$('.ms-acal-month').ready(function () {
setTimeout(function() {
$('a[href*="DispForm.aspx"]').each(function() {
$(this).attr('onclick', 'openDialogBox("' + $(this).attr('href') + '")');
//$(this).attr('onclick', ' ');
//alert($(this).attr('href'));
});
$('a[href*="DispForm.aspx"]').each(function() {
$(this).attr('href','javascript:openDialogBox("' + $(this).attr('href') + '")');
});
}, 3000);
});
})(jQuery);
</script>
Run Code Online (Sandbox Code Playgroud)
如果它是相关的,这是我试图用脚本实现的:
我在SharePoint 2013上.我有一个表格,其中有一个日历视图中显示的活动日历.如果用户想要编辑日历上显示的已添加事件,我会遇到一些问题. - 显示事件的单元格显示事件的标题,并且它是超链接的.如果用户双击单元格(在空白区域中),则会按照我希望的方式将其转移到默认显示页面.但是,如果他碰巧点击了超链接标题,则默认显示页面不会打开,而是实际的整个项目
我希望始终打开默认显示形式的原因是因为我有一个隐藏/显示字段的自定义脚本
非常感谢Ijlal