此代碼不工作,如果你把它作爲一個書籤:
javascript:if%20(document.forms['aspnetForm']['MSOLayout_InDesignMode']%20!=%20null)%20document.forms['aspnetForm']['MSOLayout_InDesignMode'].value%20=%201;if%20(document.forms['aspnetForm']['MSOAuthoringConsole_FormContext']%20!=%20null)%20document.forms['aspnetForm']['MSOAuthoringConsole_FormContext'].value%20=%201;theForm.submit();
我試圖將其轉換爲普通的JavaScript,但它不會在我的Firefox JavaScript控制檯工作。
SP_EditPage: function(){
var thisdocument = window.content.document;
if (thisdocument.forms['aspnetForm']['MSOLayout_InDesignMode'] != null)
thisdocument.forms['aspnetForm']['MSOLayout_InDesignMode'].value = 1;
if (thisdocument.forms['aspnetForm']['MSOAuthoringConsole_FormContext'] != null)
thisdocument.forms['aspnetForm']['MSOAuthoringConsole_FormContext'].value = 1;
theForm.submit();
},
我很感興趣,如果任何人都可以得到它在純javascript工作!它告訴我: 錯誤:類型錯誤:thisdocument.forms.aspnetForm未定義 源文件:的JavaScript命令行 :2
的書籤來自這個傢伙的網站: http://blog.mastykarz.nl/sharepoint-developer-bookmarklets/
這裏是另外一個。它在側邊欄打開的情況下啓動編輯頁面。這一次對我的作品罰款:
SP_EditPage: function(){
var thisdocument = getBrowser().contentWindow.document;
if(thisdocument.location.href.search('ToolPaneView=') == -1){
if (thisdocument.location.search.indexOf('?') == 0){
thisdocument.location=(thisdocument.location.href + '&ToolPaneView=2');
}else{
thisdocument.location=(thisdocument.location.href + '?ToolPaneView=2');
}
} else {
thisdocument.location=thisdocument.location.href;
}
},
偉大的解決方案!唯一的缺點是我必須在每個頁面佈局中包含此標籤,因爲我無法將其注入到母版頁中,但除此之外,我喜歡它,謝謝@rossri太多了^ _^ –