SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question javascriopt function syntax

    may i know the difference between following two script code segments :

    1)
    Code:
    <script type="text/javascript">
    (markMenuSelection('cd','cds'))();
    </script>
    this above code is posted at the end of my jsp page .. and markMenuSelection('cd','cds') is a function defined in a script file included in my jsp.

    2)
    Code:
    <script type="text/javascript">
    window.onload=markMenuSelection('cd','cds');
    </script>
    this above code is as well posted at the end of my jsp page .. and markMenuSelection('cd','cds') is a function defined in a script file included in my jsp.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,710
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •