iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • I bookmarked this site...
    123,710

    iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > Focus a Window with self.focus in Javascript

    Focus a Window with self.focus in Javascript



    To focus a window with self.focus in Javascript:

    <body onLoad="self.focus()">


    -In the HTML body tag, we use Javacript's onLoad event handler.
    -We call Javascript's built-in focus method. (The self property refers to the window we're in.)
    -The window that contains this tag will come to the front when it loads... great for pop-up windows.


    We could also simply put our call in Javascript tags like so:

    <script type="text/javascript">
    self.focus();
    </script>

    -In this scenario, we would get the same result of the window focusing when it loads, but we could also write this into a function to get different results.


    Free Copy and Paste Javascript Code:

    <script type="text/javascript">
    self.focus();
    </script>

    <body onLoad="self.focus()">



    Resources:
    Use onLoad in Body Tag with Javascript
    Opening a REMOTE WINDOW in Javascript
    Create a Function in Javascript
    Call your Function in Javascript
    Use onLoad to Call More than One Function with Javascript



    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Select All or Highlight Text Fields and Textareas Using Javascript
    Next Article: Use innerHTML to Change Text on a Page





    New Perspectives on HTML...New Perspectives on HTML and XHTML 5...

    Partrick Carey

    New $67.45

    HTML & XHTMLHTML & XHTML

    Chuck Musciano, Bi...

    New $29.99

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $26.99

    Creating Web SitesCreating Web Sites

    Matthew MacDonald

    New $19.77

    HTMLHTML

    Gary B. Shelly, Th...

    New $84.55

    CSSCSS

    David McFarland

    New $23.09

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.85

    Head First HTML with CSS...Head First HTML with CSS & XHTML

    Eric Freeman, Elis...

    New $23.99


    Of Interest:
  • What Environmental Variables are Available
  • OPEN and WRITE a Data File in Perl
  • Getting What is Matched in Perl
  • Get the Length of a Word or String in Perl
  • Javascript Subscript Text
  • PRINT to Browser with document.write Command in Javascript
  • Use onMouseOut in Javascript
  • Opening an Alert Box in Javascript
  • HTML Link
  • HTML Space
  • HTML Underline Text
  • HTML Center

  • More Articles:
  • INCREMENT and DECREMENT a Variable in Perl
  • Opening and Reading a Directory in Perl
  • Add to the Beginning of an Array with Unshift in Perl
  • Delete a File Using unlink in Perl
  • onClick Javascript
  • Mimic Typing from a Textfield in a Textarea with Javascript
  • Setting a Cookie using Javascript
  • Use onMouseOut in Javascript
  • HTML Tables
  • Make Strikethrough Text Using HTML
  • HTML Subscript Text
  • Make Text Bold Using HTML

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    420,471
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:13 EDT