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...
    142,968

    iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > Use OnMouseOver in Javascript

    Use OnMouseOver in Javascript



    There are a couple of ways to use OnMouseOver in Javascript...

    If you've used onClick, then you already know how to use onMouseOver.

    You can write the javascript right into the link tag or you can call a function located elsewhere in your code.

    First, we'll write the code right into the link:

    <a href="#" OnMouseOver="javascript:alert('Thanks for the onMouse!')">Need an onMouse?</a>

    -After the OnMouseOver tag, we enclose our entire javascript code in double quotation marks.
    -We start with the javascript: to tell the browser we have javascript code coming up.
    -We use javascript's built-in alert method to open an alert box. Since we are inside double quotes, we use single quotes around our message.


    Using OnMouseOver to call a function is similar and fairly easy:

    function sayHey() {
    alert('Thanks for the onMouse!');
    }

    <a href="#" OnMouseOver="javascript:sayHey()">Do you need an onMouse?</a>

    -First we created our function sayHey.
    -Instead of writing our code in the OnMouseOver tag, we just called our newly created function.


    Note: I don't know why, but Firefox for Mac hangs after executing onMouseOver. You can't back up or click on anything in the browser window. Safari for Mac and Windows IE and Firefox tested okay.


    Free Copy and Paste Javascript Code:

    <script type="text/javascript">
    <!--

    function sayHey() {
    alert('Thanks for the onMouse again!');
    }

    -->
    </script>

    <a href="#" OnMouseOver="javascript:alert('Thanks for the onMouse!')">On Mouse 1</a>
    <a href="#" OnMouseOver="javascript:sayHey()">On Mouse 2</a>



    Resources:
    Use onClick in Javascript
    Create a Function in Javascript
    Call your Function in Javascript
    Opening an Alert Box in Javascript


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Use onClick in Javascript
    Next Article: Use onMouseOut in Javascript





    New Perspectives on HTML...New Perspectives on HTML, XHTML, and...

    Patrick Carey

    New $69.26

    Bulletproof Web DesignBulletproof Web Design

    Dan Cederholm

    New $23.99

    CSSCSS

    David McFarland

    New $23.09

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    New Perspectives on Crea...New Perspectives on Creating Web Pag...

    Patrick Carey

    New $69.26

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $26.99

    Information Architecture...Information Architecture for the Wor...

    Louis Rosenfeld, P...

    New $26.39

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39


    Of Interest:
  • Matching at the Beginning and End
  • To Sort an Array in Perl
  • Exit a Script or Subroutine in Perl
  • Add, Subtract, Multiply, and Divide in Perl
  • Select All or Highlight Text Fields and Textareas Using Javascript
  • Use onLoad in Body Tag with Javascript
  • Get String Length with Javascript
  • Change a Form Field with Javascript
  • HTML Underline Text
  • Make Strikethrough Text Using HTML
  • Make Italic Text Using HTML
  • HTML Forms

  • More Articles:
  • Matching at the Beginning and End
  • Finding the Length (Index Numbers) of an Array in Perl
  • Use chmod in Perl
  • Create an Array of Specific Numbers in Perl
  • onClick Javascript
  • Use onLoad in Body Tag with Javascript
  • Focus a Window with self.focus in Javascript
  • Annoy Users with onBlur in Javascript
  • Close Window with window.close in Javascript
  • Make Strikethrough Text Using HTML
  • HTML Codes
  • HTML Tags
  • HTML Body Tag

  • 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


    439,733
    Counter by iLoveTheCode.com


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