Monday, November 16, 2009
[Study] Maintaining Redo Log Files
1:11:00 PM | Filed Under oracle, slide share | 0 Comments
Friday, November 06, 2009
WSS 3.0 Open links In New Window
這兩個禮拜一直在替WSS換長相,摸出了一些心得。不過今天不講這些XD
講一下WSS的超連結,預設行為都是開在同一個頁面,但是對於那些專門做連結的清單、或是就是要另開新視窗的連結而言,若無法改變WSS行為,操作起來就相當麻煩。
Entonces, 該如何設定讓WSS的特定頁面的超連結行為為開新視窗呢?
- 移駕至該頁面
- 點選右上角"網站動作" > "編輯頁面" > "新增網頁組件"
- 選擇"內容編輯器網頁組件" > 新增
- 組件新增至頁面上後,點選內容的"開啟工具窗格"
- 點選"原始檔編輯器...",會跳出一個空白對話框,在裡面貼上以下程式:
1: <script language="JavaScript">
2:
3: //add an entry to the _spBodyOnLoadFunctionNames array
4: //so that our function will run on the pageLoad event
5:
6: _spBodyOnLoadFunctionNames.push("rewriteLinks");
7:
8: function rewriteLinks() {
9:
10: //create an array to store all the anchor elements in the page
11: var anchors = document.getElementsByTagName("a");
12:
13: //loop through the array
14:
15: for (var x=0; x<anchors.length; x++) {
16: //does this anchor element contain #openinnewwindow?
17:
18: if (anchors[x].outerHTML.indexOf('#openinnewwindow')>0) {
19: //store the HTML for this anchor element
20: oldText = anchors[x].outerHTML;
21:
22: //rewrite the URL to remove our test text and add a target instead
23: newText = oldText.replace(/#openinnewwindow/,'" target="_blank');
24:
25: //write the HTML back to the browser
26: anchors[x].outerHTML = newText;
27: }
28: }
29: }
30:
31: </script>
- 儲存後,另外在"版面配置"區段下將"隱藏"方框勾選起來即可套用,並結束編輯頁面。
- 最後,針對該頁面需要在新視窗開啟的超連結網址後面全部加上"#openinnewwindow"即可!!!
稍微說明一下上面那段javascript主要在做什麼:
首先,第7點說的在網址後面加上"#openinnewwindow"字樣其實是跟程式互相配合的,行18即是尋找所有超連結網址裡是否有這個字樣,如果有找到,就把他換成" target=_blank"這樣而已XD 所以有該字樣的 <A>tag行為就會變成以新視窗開啟了~
11:41:00 AM | Filed Under SharePoint | 0 Comments