home *** CD-ROM | disk | FTP | other *** search
/ PC User 2007 May / Australian_PC_User_2007-05.iso / software / brows / files / sbsetup.exe / GetActiveDoc.js < prev    next >
Encoding:
Text File  |  2006-05-10  |  328 b   |  26 lines

  1. function GetActiveDoc()
  2. {
  3.     var doc;
  4.     try 
  5.     {
  6.         doc=GetActiveDocEx(top.document);
  7.     }
  8.   catch(e)
  9.     {
  10.         doc=null;
  11.     }
  12.     return doc;
  13. }
  14.  
  15.  
  16. function GetActiveDocEx(doc)
  17. {
  18.     if (doc.activeElement.tagName=="FRAME")
  19.     {
  20.         return GetActiveDocEx(doc.activeElement.contentWindow.document);
  21.     }    
  22.     else
  23.     {
  24.         return doc;
  25.     }
  26. }