home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 May / PersonalComputerWorld-May2008-CoverdiscCD.iso / Software / Full / Nero 7 / Installation / Cab / 83AF5E4E.cab / iFrameContentFocusE5E4E19C.js < prev    next >
Encoding:
JavaScript  |  2006-06-20  |  1.6 KB  |  26 lines

  1.  
  2. /* This script provides invisible focusable elements at the top. bottom, left and right of a frame-content page. When you focus on
  3.   any of these, the focus will automatically go back up to the parent page that contains the frame. This allows you to jump the
  4.   focus back and forth between the parent and child pages; when you click past the last button in any direction you hit one of
  5.   these placeholders and the focus moves back to the parent page. (The reason they are positioned so far off the visible page is
  6.   to make sure that each is focusable from any element on the page when you hit the arrow for that direction.) */
  7.   
  8. var pageWidth = body.scrollWidth
  9. var pageHeight = body.scrollHeight
  10.  
  11. //document.write ('<span MCFocusable="true" style="position: absolute; top: -1000; left: 0; width: 100%; height: 20;" onfocus="sendFocusBackToParent()"></span>') // top element
  12. //document.write ('<span MCFocusable="true" style="position: absolute; top: ' + (pageHeight + 1000) + '; left: 0; width: 100%; height: 20;" onfocus="body.scrollTop=0;sendFocusBackToParent()"></span>') // bottom element
  13.  
  14. document.write ('<span MCFocusable="true" style="position: absolute; top: 0; left: -1000; width: 20; height: 100%;" onfocus="sendFocusBackToParent()"></span>') // left element
  15.  
  16. //document.write ('<span MCFocusable="true" style="position: absolute; top: 0; left: ' + (pageWidth+1000) +'; width: 20; height: 100%;" onfocus="body.scrollLeft=0;sendFocusBackToParent()"></span>') // right element
  17.  
  18.  
  19.  
  20. function sendFocusBackToParent()
  21. {
  22.     //this function sends the focus back to the parent page    
  23.     oCurFocus = null
  24.     window.top.moveFocusBackToIFrame();
  25. }
  26.