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



  • Pass the Javascript, please...
    20,095

    iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > Annoy Users with onBlur in Javascript

    Annoy Users with onBlur in Javascript



    <body onBlur="self.focus();">

    -We used Javascript's built-in onBlur event handler.
    -We then called Javascript's built-in focus method. (self in this instance means "this window")
    -We put all this in the HTML body tag.

    NOTE: This would force a user to close the window before moving on so you could keep a user on your site forever and ever... actually, it has other uses, like calling a function, etc. This was just an easy way to show how it works.

    NOTE: onBlur can be used in many different places other than the body tag, like a textarea, text field, select menu, frame and frameset.

    NOTE: Safari for Mac will only bring the window back into focus once. You'll have to find a different way to annoy us :)



    Free Copy and Paste Javascript Code:

    <script type="text/javascript">
    <!--
    function yoyo() {
    window.close();
    }
    -->
    </script>

    <body onBlur="yoyo()">


    Resources:
    Focus a Window with self.focus in Javascript
    Create a Function in Javascript
    Call your Function in Javascript


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Get Query String Using Javascript
    Next Article: Javascript Reset Form





    JavaScriptJavaScript

    David Flanagan

    New $31.49

    CSSCSS

    Eric Meyer

    New $29.69

    Dreamweaver CS3Dreamweaver CS3

    David McFarland

    New $29.69

    Bulletproof Web DesignBulletproof Web Design

    Dan Cederholm

    New $26.39

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $29.69

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.09

    Creating Web SitesCreating Web Sites

    Matthew MacDonald

    New $19.77

    CSSCSS

    David McFarland

    New $23.09

    HTML, XHTML, and CSS, Si...HTML, XHTML, and CSS, Sixth Edition ...

    Elizabeth Castro

    New $23.09


    Of Interest:
  • What's in an Array, Index Numbers
  • To See if a Directory Exists in Perl
  • Write a FOREACH LOOP in Perl
  • Create an Array of Specific Numbers in Perl
  • Reading Cookies using Javascript
  • Opening an Alert Box in Javascript
  • Annoy Users with onBlur in Javascript
  • Substitute in Javascript Using replace Method
  • HTML Background
  • HTML Subscript Text
  • HTML Superscript Text
  • HTML Forms

  • More Articles:
  • Finding the Length (Index Numbers) of an Array in Perl
  • Add to the Beginning of an Array with Unshift in Perl
  • Write a FOR LOOP in Perl
  • Write a FOREACH LOOP in Perl
  • onClick Javascript
  • Select All or Highlight Text Fields and Textareas Using Javascript
  • Use innerHTML to Change Text on a Page
  • If, Else If, and Else in Javascript
  • Match with a Regular Expression, REGEX, in Javascript
  • Make a Line Return Using HTML
  • Make Italic Text Using HTML
  • HTML Image
  • HTML Background

  • 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


    316,835
    Counter by iLoveTheCode.com


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