Hwo to Open Navigation Item in New Window on SharePoint Portal

FROM:http://ms.mblogger.cn/tedteng/posts/13312.aspx

 

Heikou asked on MS SPS Community:

is there any possibility to make the default links the left navigation
open in a new window?

My Sharepoint works in an IFrame of a different site. I don't want to
change all the admin pages to fit the design of the "mothers page".
That's why I want some of them open in a new window, which is less
disturbing.

I wrote a tip about “Open in new window“ as below link

http://ms.mblogger.cn/tedteng/posts/10064.aspx

To suit Heiko's requriment, I changed the codes for him. hope it is helpful for him.


/*=========added by ted on 2004-02-25============*/
/*ideas coming from Mark Beecham

http://www.msd2d.com/Content/Tip_viewitem_03.aspx?section=SharePoint&category=Development&id=b73b9ea8-a678-47d0-b440-002b7f1c5ab3

*/

/*

Open the OWSBROWS.JS and locate the line:

var browseris = new Browseris();

Paste the following code under this line.
*/

/* START - Custom Code*/


//Define a varibalbe to check whether the below function used
var newWinLoaded = false;

//Attach to Load event
window.attachEvent("onload", new Function("NewWin_OnLoad();"));

//Change all A Tags target attribute vale to "_blank"
function NewWin_OnLoad()
{
 try{

 if (!newWinLoaded)
 {
       //Get all Tags named "A"
      var aTags = document.getElementsByTagName("A");
       //Look for "A" tags
         for(var j=0;j< aTags.length;j++){
         var aTag = aTags(j);
  if (aTag.id.indexOf("Nav")>=0)//check whether it is Navgation Item
   {
          aTag.setAttribute("target","_blank");
   }

     }//end of for
     newWindLoaded = true;
 }//end of if newWinLoaded
 }//try
 catch(e){
    //Do Nothing - if it doesn't work
 alert("error");
 }//end of try

}//end of fucntion New Window

 

/* END - Custom Code*/

posted @ 2008-10-23 19:58  laputa'sky  阅读(270)  评论(0编辑  收藏  举报