Results 1 to 3 of 3

Thread: how to call an function with i a javascript function

  1. #1
    Join Date
    Jul 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to call an function with i a javascript function

    hi,



    Code:
    <html>
    <head>
             <script language="javascript">
                    function domyAction(){
                     onemoreAction('arg1,arg2,arg3,arg4'); //-------> this described in .js file                }
             </script>
    </head>
    <body>
    <select onchange="domyAction()">
      <option value ="volvo">Volvo</option>
      <option value ="saab">Saab</option>
      <option value ="opel">Opel</option>
      <option value ="audi">Audi</option>
    </select>
    </body>
    </html>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
             <script language="javascript">
                    function domyAction(){
                     onemoreAction('arg1,arg2,arg3,arg4'); //-------> this described in .js file                }
             </script>
    This will do nothing because:

    a ) The closing brace for the containing function is after a comment delimiter.

    b ) All well and good that the function within the function is described elsewhere, but you show no link to or any other evidence of that 'elsewhere'.

    c ) 'arg1,arg2,arg3,arg4' is only one parameter. It should be either:

    'arg1',arg2','arg3','arg4'

    or:

    arg1,arg2,arg3,arg4

    or some combination. With the quotes, the arguments are literals, without them they are variable values.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi,


    -----------> 'arg1',arg2','arg3','arg4'

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
  •