JavaScript Error missing ( before formal parmeters

Last post 05-25-2008 1:34 AM by ivobrabec. 9 replies.

Sort Posts:

  • JavaScript Error missing ( before formal parmeters

    02-22-2008, 12:51 PM
    • Loading...
    • Jackxxx
    • Joined on 04-13-2003, 11:43 AM
    • Northern California
    • Posts 1,419

    I use the following javascript to time and close a window. I get the error: 'missing ( before formal parameters' on the bold line below. Can anyone see why?

    <script type="text/javascript">
      var idle = true;
      function window.onload() {
      window.setTimeout("checkTimeout()", 10000);
      }
      function checkTimeout() {
        if (idle) window.close();
        window.setTimeout("checkTimeout()", 10000);
      }
      function document.onkeypress() { 
      idle = false;
      }
      </script>
     
    Thank you

    Jackxxx
  • Re: JavaScript Error missing ( before formal parmeters

    02-22-2008, 1:03 PM
    • Loading...
    • Jeev
    • Joined on 11-24-2005, 7:49 AM
    • Posts 2,261

    Jack.. I tried your code and it seemed fine..and did not get any JS errors. I do not think this code snippet is the cause of the error

    Jeev
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If you get the answer to your question, please mark it as the answer.
  • Re: JavaScript Error missing ( before formal parmeters

    02-22-2008, 1:17 PM
    • Loading...
    • Jackxxx
    • Joined on 04-13-2003, 11:43 AM
    • Northern California
    • Posts 1,419

    I have been testing our app with FireFox and FireBug, FireBug found the error, IE does not.

    Thank you

    Jackxxx
  • Re: JavaScript Error missing ( before formal parmeters

    02-27-2008, 3:35 AM

    Jackxxx:

    I have been testing our app with FireFox and FireBug, FireBug found the error, IE does not.

     

    Hi Jackxxx,

    What is error?  You can search the error online, maybe you can easy find the answer.

    OR:

    Please post the whole code here if the problem remains unsolved.

    Waiting for your feedback,

    Hong Gang 

    Sincerely,
    Hong Gang Chen
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: JavaScript Error missing ( before formal parmeters

    04-25-2008, 2:48 PM
    • Loading...
    • fatfrank5
    • Joined on 04-25-2008, 6:45 PM
    • Posts 1

    I'm also experiencing the same issue as you.. :(

    It only happens in FireFox and not IE. Any time I try to create a function with a dot. eg

    var a = {};

    a.someMethod = function(){};

  • Re: JavaScript Error missing ( before formal parmeters

    05-14-2008, 3:11 AM
    • Loading...
    • Juztin
    • Joined on 05-14-2008, 7:06 AM
    • Posts 3
    Hello Jackxxx, Yes that script will work in JScript but will not work in Javascript. you could do this to make it work in both :)
    instead of
    function window.onload() {...
    try this
    window.onload = function() {...

    and instead of
    function document.onkeypress() {...
    try this
    document.onkeypress = function() {...

    That should work in both JScript and Javascript..
  • Re: JavaScript Error missing ( before formal parmeters

    05-14-2008, 7:00 PM
    • Loading...
    • Juztin
    • Joined on 05-14-2008, 7:06 AM
    • Posts 3

    I posted a bit more information in a blog post here :) Hope this helped

    http://juztinwilzon.blogspot.com/2008/05/missing-before-formal-parameters.html

  • Re: JavaScript Error missing ( before formal parmeters

    05-23-2008, 7:21 AM
    • Loading...
    • ivobrabec
    • Joined on 05-23-2008, 7:18 AM
    • Posts 2

    I read your explanation on this error as I am experiencing similar problem. But I was not able to implement your help to my case...

    I have this code

    <script src=http://www.etsmoney.com/scripts/iban.js type="text/javascript"></script>
    <script>
             <!--
             {
             var oIBANcheck=new checkIBAN(document.form,"iban");
             }
             //-->
    </script>

    In IE it works, in Mozzila it gives the folowin error:

    Error: missing ( before formal parameters
    Source File: http://www.etsmoney.com/scripts/iban.js
    Line: 21, Column: 18
    Source Code:
    function checkIBAN.prototype.removeNonValidChars(strIBAN_)

     

    I cannot figure out what is the problem.
    Thanks for your help.

    Ivo

  • Re: JavaScript Error missing ( before formal parmeters

    05-24-2008, 5:04 PM
    • Loading...
    • Juztin
    • Joined on 05-14-2008, 7:06 AM
    • Posts 3
    ok, the problem looks to be with this line
    'function checkIBAN.prototype.removeNonValidChars(strIBAN_)....'

    JScript (IE) allows you to declare functions using the dot notation ('function namespace.object.newMethodName() {}')
    Javascript (Mozilla and others) does not allow declaring function names with any dot notation

    So you could change the function declaration to this
    checkIBAN.prototype.removeNonValidChars = function(strIBAN) { /* your implementation */ };

    Just don't forget to add the semicolon to the end after the curly. It will work if it's the last thing before a carriage return, but if you compress your javascript (remove whitespace, carriage returns) then it will complain in both browsers since it doesn't know where the statement ends.
  • Re: JavaScript Error missing ( before formal parmeters

    05-25-2008, 1:34 AM
    • Loading...
    • ivobrabec
    • Joined on 05-23-2008, 7:18 AM
    • Posts 2
    thank thats helped....
Page 1 of 1 (10 items)