Simple function won't fire

Discussion in 'Javascript' started by Rod, Apr 23, 2006.

  1. Rod

    Rod Guest

    I can't get this alert to show no matter what I do. Making me crazy.
    One doesn't equal two...does it?

    <html>
    <head>
    <title>Rider Survey</title>
    <link rel="stylesheet" type="text/css" href="ez.css">
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <script type="text/javascript">
    <!-- Hide from odd browsers
    function Checkcheck(){
    If (1 != 2){
    alert("This alert finally came up!");
    return false;}
    Else {return true;}
    }
    // stop hiding -->
    </script>
    </head>

    The function is called from an "onsubmit" in the form tag, ie
    <form name="survey" action="gdform.asp" method="POST" onsubmit="return
    Checkcheck();">

    Shouldn't the alert show every time the "Submit" button is clicked? I
    haven't seen it so far. What up?
    Rod, Apr 23, 2006
    #1
    1. Advertising

  2. Rod

    Quitchat Guest

    Hi Rod,
    Are you sure it's " If " and " Else " rather than " if " and " else "?

    Hope that helps.

    Regards,
    QC.
    Quitchat, Apr 23, 2006
    #2
    1. Advertising

  3. Rod

    Evertjan. Guest

    Quitchat wrote on 23 apr 2006 in comp.lang.javascript:

    > Hi Rod,
    > Are you sure it's " If " and " Else " rather than " if " and " else "?
    >


    Please quote what you are replying to.

    If you want to post a followup via groups.google.com, don't use the
    "Reply" link at the bottom of the article. Click on "show options" at the
    top of the article, then click on the "Reply" at the bottom of the article
    headers. <http://www.safalra.com/special/googlegroupsreply/>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Apr 23, 2006
    #3
  4. Rod

    Randy Webb Guest

    Rod said the following on 4/23/2006 1:17 AM:
    > I can't get this alert to show no matter what I do. Making me crazy.
    > One doesn't equal two...does it?
    >
    > <html>
    > <head>
    > <title>Rider Survey</title>
    > <link rel="stylesheet" type="text/css" href="ez.css">
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=iso-8859-1">
    > <script type="text/javascript">
    > <!-- Hide from odd browsers


    I think that is the first time I have ever seen them called "odd browsers"

    > function Checkcheck(){
    > If (1 != 2){


    If != if

    > alert("This alert finally came up!");
    > return false;}
    > Else {return true;}


    Else != else

    Case matters.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Apr 23, 2006
    #4
  5. Rod

    ASM Guest

    Rod a écrit :
    > I can't get this alert to show no matter what I do. Making me crazy.
    > One doesn't equal two...does it?


    <script type="text/javascript">
    <!-- Hide from odd browsers
    function Checkcheck(){
    if (1 != 2){
    alert("This alert finally came up!");
    return false;
    }
    return true;
    }
    // stop hiding -->
    </script>

    it is 'if' and not 'If'



    --
    Stephane Moriaux et son [moins] vieux Mac
    ASM, Apr 23, 2006
    #5
  6. ASM wrote:
    > Rod a écrit :
    >> I can't get this alert to show no matter what I do. Making me crazy.
    >> One doesn't equal two...does it?

    >
    > <script type="text/javascript">
    > <!-- Hide from odd browsers


    What will the Javascript parser make of "<!--"?

    Javascript one line comments are started with "//"

    The script is not going to be parsed. Check Firefox's Javascript console.
    TheBagbournes, Apr 23, 2006
    #6
  7. Rod

    Rod Guest

    Rod wrote:
    > I can't get this alert to show no matter what I do. Making me crazy.
    > One doesn't equal two...does it?
    >
    > <html>
    > <head>
    > <title>Rider Survey</title>
    > <link rel="stylesheet" type="text/css" href="ez.css">
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=iso-8859-1">
    > <script type="text/javascript">
    > <!-- Hide from odd browsers
    > function Checkcheck(){
    > If (1 != 2){
    > alert("This alert finally came up!");
    > return false;}
    > Else {return true;}
    > }
    > // stop hiding -->
    > </script>
    > </head>
    >
    > The function is called from an "onsubmit" in the form tag, ie
    > <form name="survey" action="gdform.asp" method="POST" onsubmit="return
    > Checkcheck();">
    >
    > Shouldn't the alert show every time the "Submit" button is clicked? I
    > haven't seen it so far. What up?


    All who replied said the same thing and all were right. It's case
    sensitive. Thanks to each of you for taking the time.
    Rod
    Rod, Apr 23, 2006
    #7
  8. TheBagbournes wrote:

    > ASM wrote:
    >> Rod a écrit :
    >>> I can't get this alert to show no matter what I do. Making me crazy.
    >>> One doesn't equal two...does it?

    >>
    >> <script type="text/javascript">
    >> <!-- Hide from odd browsers

    >
    > What will the Javascript parser make of "<!--"?


    Since there is no such thing as /the/ "Javascript parser", that is unknown.
    At least current _JavaScript_ and JScript parsers will regard the following
    text up to the newline as a comment. That is a known extension to
    ECMAScript, but one that should not be relied upon (see below for details).

    > Javascript one line comments are started with "//"


    That is true for all ECMAScript implementations.

    > The script is not going to be parsed.


    That is only half the truth. Provided that

    1. what was posted is HTML, or XHTML served as text/html (the latter is
    recommended against), and

    2. the SpiderMonkey JavaScript engine or Microsoft JScript is used,

    the script /is/ going to be parsed. The `script' element is regarded as
    CDATA there, and is therefore passed as-is to the respective script engine
    up to the first ETAGO delimiter encountered ("</"; standards compliant) or
    </script> end tag (some implementations). Due to the aforementioned
    extension of ECMAScript, those script engines will ignore this line.

    However, there are several reasons why it is strongly recommended against
    using use "comment declaration" delimiters in that way:

    - This extension of ECMAScript cannot be considered to be interoperable,
    and there is no fallback.

    - If the markup is XHTML, properly served as application/xhtml+xml or the
    resource name includes a corresponding name suffix (.xhtm*), the `script'
    element content is regarded PCDATA where all comments may be removed by
    the (XML) parser before building the parse tree.

    - It is completely unnecessary. HTML 2.0 is marked obsolete since 6 years
    now, and pre-HTML-3.2 user agents went out of fashion long before; if
    there is still one, or if it renders the content of a `script' element
    within the `head' element, it is broken.

    > Check Firefox's Javascript console.


    The scripting language Firefox supports is called JavaScript for a reason.


    PointedEars
    --
    Bill Gates isn't the devil -- Satan made sure hell
    _worked_ before he opened it to the damned ...
    Thomas 'PointedEars' Lahn, Apr 23, 2006
    #8
  9. Rod

    Evertjan. Guest

    Rod wrote on 23 apr 2006 in comp.lang.javascript:

    > All who replied said the same thing and all were right. It's case
    > sensitive. Thanks to each of you for taking the time.


    A simple case of JS case hypersensitivity?


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Apr 23, 2006
    #9
  10. Rod

    Randy Webb Guest

    Thomas 'PointedEars' Lahn said the following on 4/23/2006 3:55 PM:
    > TheBagbournes wrote:
    >
    >> ASM wrote:
    >>> Rod a écrit :
    >>>> I can't get this alert to show no matter what I do. Making me crazy.
    >>>> One doesn't equal two...does it?
    >>> <script type="text/javascript">
    >>> <!-- Hide from odd browsers

    >> What will the Javascript parser make of "<!--"?

    >
    > Since there is no such thing as /the/ "Javascript parser", that is unknown.


    Yes it is. Your lack of understanding of the English language is evident
    in your assumption about the statement.

    > At least current _JavaScript_ and JScript parsers will regard the following
    > text up to the newline as a comment. That is a known extension to
    > ECMAScript, but one that should not be relied upon (see below for details).


    Not a lot of what you write after your pedantics start is worth reading
    sometimes.

    >> Javascript one line comments are started with "//"

    >
    > That is true for all ECMAScript implementations.


    Does that mean you have tested them ALL or are you assuming again?

    >> The script is not going to be parsed.

    >
    > That is only half the truth. Provided that


    It is not even half true.

    > 1. what was posted is HTML, or XHTML served as text/html (the latter is
    > recommended against), and


    If it is HTML then it will get parsed by the Script Engine.

    > 2. the SpiderMonkey JavaScript engine or Microsoft JScript is used,


    Or any other script engine that honors the script tag.

    > the script /is/ going to be parsed. The `script' element is regarded as
    > CDATA there, and is therefore passed as-is to the respective script engine
    > up to the first ETAGO delimiter encountered ("</"; standards compliant) or
    > </script> end tag (some implementations).


    Name one under 5 years old that stops at the first </ when being served
    HTML.

    > Due to the aforementioned extension of ECMAScript, those script engines
    > will ignore this line.


    ECMAScript is irrelevant. It is not an "extension of ECMAScript", it is
    an extension of Javascript and JScript. There is a reason why the script
    tag doesn't say:

    <script type="text/ecmascript">

    > However, there are several reasons why it is strongly recommended against
    > using use "comment declaration" delimiters in that way:
    >
    > - This extension of ECMAScript cannot be considered to be interoperable,
    > and there is no fallback.


    Sure there is. Name a browser that balks on it with HTML.

    > - If the markup is XHTML, properly served as application/xhtml+xml or the
    > resource name includes a corresponding name suffix (.xhtm*), the `script'
    > element content is regarded PCDATA where all comments may be removed by
    > the (XML) parser before building the parse tree.


    There are no suffixes/extensions on the Web. But, you should feed a
    "resource" (as you refer to it) with a "suffix" of .xhtml to IE sometime.

    > - It is completely unnecessary. HTML 2.0 is marked obsolete since 6 years
    > now, and pre-HTML-3.2 user agents went out of fashion long before; if
    > there is still one, or if it renders the content of a `script' element
    > within the `head' element, it is broken.


    It wasn't "broken", it was doing what it was designed to do.

    >> Check Firefox's Javascript console.

    >
    > The scripting language Firefox supports is called JavaScript for a reason.


    You should learn how to read plain English, and apply common sense to
    it, before babbling your BS. Especially in an English group. Your BS
    behavior may work for you in de.* but I don't post there.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Apr 24, 2006
    #10
  11. Rod

    ASM Guest

    Randy Webb a écrit :
    > Thomas 'PointedEars' Lahn said the following on 4/23/2006 3:55 PM:
    >
    >> TheBagbournes wrote:
    >>
    >>> ASM wrote:


    could you put me away from this vain fight
    I wrote anything in lines below !

    >>>
    >>>> Rod a écrit :
    >>>>
    >>>>> I can't get this alert to show no matter what I do. Making me crazy.
    >>>>> One doesn't equal two...does it?
    >>>>
    >>>> <script type="text/javascript">
    >>>> <!-- Hide from odd browsers
    >>>
    >>> What will the Javascript parser make of "<!--"?

    >>
    >>
    >> Since there is no such thing as /the/ "Javascript parser", that is
    >> unknown.

    >
    >
    > Yes it is. Your lack of understanding


    --
    Stephane Moriaux et son [moins] vieux Mac
    ASM, Apr 24, 2006
    #11
  12. Randy Webb <> writes:

    > Thomas 'PointedEars' Lahn said the following on 4/23/2006 3:55 PM:


    >> TheBagbournes wrote:
    >>> Javascript one line comments are started with "//"

    >> That is true for all ECMAScript implementations.

    >
    > Does that mean you have tested them ALL or are you assuming again?


    It's a matter of definition.
    While the original claim was vague (what is a one-line comment?)
    and technically incorrect for some readings (/*foo*/ could be a
    one-line comment), the most accepting reading is that the poster
    knows that "//" starts a comment to end of line.

    It is correct that an ECMAScript implementation must also satisfy
    this. (Well, a compliant ecmascript implementation, but isn't VBScript
    just a *very* non-compliant ECMAScript implementation :).


    >> the script /is/ going to be parsed. The `script' element is regarded as
    >> CDATA there, and is therefore passed as-is to the respective script engine
    >> up to the first ETAGO delimiter encountered ("</"; standards compliant) or
    >> </script> end tag (some implementations).

    >
    > Name one under 5 years old that stops at the first </ when being
    > served HTML.


    An HTML parser? The W3C validator.
    Browsers are more forgiving, but they are not the only HTML parsers
    around :)


    /L
    --
    Lasse Reichstein Nielsen -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
    Lasse Reichstein Nielsen, Apr 24, 2006
    #12
  13. JRS: In article <>, dated
    Sun, 23 Apr 2006 21:02:57 remote, seen in news:comp.lang.javascript,
    Randy Webb <> posted :
    >
    >You should learn how to read plain English, and apply common sense to
    >it, before babbling your BS. Especially in an English group. Your BS
    >behavior may work for you in de.* but I don't post there.


    AFAICS, they are against his bullying attitude over there too; but
    they've taken to treating him like the better sort of German treated
    their own government in the middle nineteen-thirties. It did no good.

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
    <URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
    <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
    <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
    Dr John Stockton, Apr 25, 2006
    #13
  14. Rod

    optimistx Guest

    "Dr John Stockton" <> kirjoitti viestissä
    news:...
    ....
    > but
    > they've taken to treating him like the better sort of German treated
    > their own government in the middle nineteen-thirties.


    made him Reichskanzler?
    optimistx, Apr 25, 2006
    #14
  15. Rod

    Randy Webb Guest

    Lasse Reichstein Nielsen said the following on 4/24/2006 2:01 AM:
    > Randy Webb <> writes:
    >
    >> Thomas 'PointedEars' Lahn said the following on 4/23/2006 3:55 PM:

    >
    >>> TheBagbournes wrote:
    >>>> Javascript one line comments are started with "//"
    >>> That is true for all ECMAScript implementations.

    >> Does that mean you have tested them ALL or are you assuming again?

    >
    > It's a matter of definition.


    That is true but I wasn't even referring to the definition of a one line
    comment. I was referring to the fact that unless you can test something
    in 100% of environments then you can't claim it as fact. And the lack of
    dis-proof isn't proof.

    > While the original claim was vague (what is a one-line comment?)
    > and technically incorrect for some readings (/*foo*/ could be a
    > one-line comment), the most accepting reading is that the poster
    > knows that "//" starts a comment to end of line.


    Very true.

    > It is correct that an ECMAScript implementation must also satisfy
    > this. (Well, a compliant ecmascript implementation, but isn't VBScript
    > just a *very* non-compliant ECMAScript implementation :).


    And my point is that there could very well be a browser/UA
    implementation that is an "ECMA Implementation" that has a bug in it
    that doesn't handle // properly.

    Doesn't make it a non-ECMA implementation, just makes it buggy and it
    doesn't handle // properly.

    But it is all moot, it's just my opinion of ECMA coming out again. :-\

    >>> the script /is/ going to be parsed. The `script' element is regarded as
    >>> CDATA there, and is therefore passed as-is to the respective script engine
    >>> up to the first ETAGO delimiter encountered ("</"; standards compliant) or
    >>> </script> end tag (some implementations).

    >> Name one under 5 years old that stops at the first </ when being
    >> served HTML.

    >
    > An HTML parser? The W3C validator.


    He was referring to "script engines", not HTML parsers. "To the
    respective script engine". The debate has been had here whether <!-- in
    a script block should be parsed by the HTML engine or the Script Engine,
    it is boring but in the archives.

    But, is the W3C Validator an "ECMA Implementation" with a script parser?<G>
    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Apr 25, 2006
    #15
  16. Rod

    Randy Webb Guest

    Dr John Stockton said the following on 4/25/2006 11:22 AM:
    > JRS: In article <>, dated
    > Sun, 23 Apr 2006 21:02:57 remote, seen in news:comp.lang.javascript,
    > Randy Webb <> posted :
    >> You should learn how to read plain English, and apply common sense to
    >> it, before babbling your BS. Especially in an English group. Your BS
    >> behavior may work for you in de.* but I don't post there.

    >
    > AFAICS, they are against his bullying attitude over there too; but
    > they've taken to treating him like the better sort of German treated
    > their own government in the middle nineteen-thirties. It did no good.


    And we all know what happened to that government and it's cronies,
    hopefully Thomas' fate won't be the same but who knows.....

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Apr 25, 2006
    #16
  17. Rod

    Randy Webb Guest

    optimistx said the following on 4/25/2006 3:29 PM:
    > "Dr John Stockton" <> kirjoitti viestissä
    > news:...
    > ....
    >> but
    >> they've taken to treating him like the better sort of German treated
    >> their own government in the middle nineteen-thirties.

    >
    > made him Reichskanzler?


    And then let him commit suicide because he was too chicken shit to be
    accountable for his actions.

    All hail Thomas!!

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Apr 25, 2006
    #17
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathy Burke
    Replies:
    1
    Views:
    1,123
    Severin
    Nov 10, 2003
  2. Brent Burkart

    SelectedIndexChanged won't fire

    Brent Burkart, Nov 21, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    1,525
    Brent Burkart
    Nov 26, 2003
  3. Chad
    Replies:
    4
    Views:
    8,327
  4. Replies:
    16
    Views:
    619
    Jarek Zgoda
    Aug 1, 2005
  5. Kevin Audleman

    Why won't my Javascript function fire?

    Kevin Audleman, Jan 5, 2010, in forum: Javascript
    Replies:
    3
    Views:
    101
    Laser Lips
    Jan 5, 2010
Loading...

Share This Page