SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    missing ( before formal parameters

    Hello, I am getting an error with this code and I can not diagnose it:

    The error is:

    Code:
    missing ( before formal parameters
    Code JavaScript:
    function reserve-drop-down() {
              var sel = document.getElementById("reserve-drop-down");
              sel.onfocus = function () {this.style.width = "auto";};
              sel.onblur = function () {this.style.width = "125px";};
    }

    Any ideas anyone please?

    Thanks for reading

  2. #2
    SitePoint Zealot
    Join Date
    May 2009
    Location
    Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The hyphen in the function name.
    The function name may contain only alphanumeric characters and the underscore.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, really... never knew that! Thanks

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by dogFang View Post
    The function name may contain only alphanumeric characters and the underscore.
    $ is also a valid character. There are 54 characters that are valid in JavaScript variable/function/object/propery/method names -

    ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is even worse-
    the first character of an identifier cannot be a digit, though any number of digits can be used thereafter.


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
  •