Simple function won't fire

R

Rod

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?
 
Q

Quitchat

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

Hope that helps.

Regards,
QC.
 
E

Evertjan.

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/>
 
R

Randy Webb

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.
 
A

ASM

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'
 
T

TheBagbournes

ASM said:
Rod a écrit :

<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.
 
R

Rod

Rod said:
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
 
T

Thomas 'PointedEars' Lahn

TheBagbournes said:
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
 
E

Evertjan.

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?
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 4/23/2006 3:55 PM:
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.
That is true for all ECMAScript implementations.

Does that mean you have tested them ALL or are you assuming again?
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:

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.
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.
 
A

ASM

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

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

Lasse Reichstein Nielsen

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

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 :).

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
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Sun, 23 Apr 2006 21:02:57 remote, seen in
Randy Webb said:
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.
 
R

Randy Webb

Lasse Reichstein Nielsen said the following on 4/24/2006 2:01 AM:
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. :-\
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>
 
R

Randy Webb

Dr John Stockton said the following on 4/25/2006 11:22 AM:
JRS: In article <[email protected]>, dated
Sun, 23 Apr 2006 21:02:57 remote, seen in

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.....
 
R

Randy Webb

optimistx said the following on 4/25/2006 3:29 PM:
"Dr John Stockton" <[email protected]> kirjoitti viestissä
....

made him Reichskanzler?

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

All hail Thomas!!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top