473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Simple function won't fire

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?

Apr 23 '06 #1
16 1278
Hi Rod,
Are you sure it's " If " and " Else " rather than " if " and " else "?

Hope that helps.

Regards,
QC.

Apr 23 '06 #2
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)
Apr 23 '06 #3
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/
Apr 23 '06 #4
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'

--
Stephane Moriaux et son [moins] vieux Mac
Apr 23 '06 #5
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.
Apr 23 '06 #6
Rod
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

Apr 23 '06 #7
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 ...
Apr 23 '06 #8
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)
Apr 23 '06 #9
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/
Apr 24 '06 #10
ASM
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
Apr 24 '06 #11
Randy Webb <Hi************@aol.com> 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 - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Apr 24 '06 #12
JRS: In article <K5******************************@comcast.com>, dated
Sun, 23 Apr 2006 21:02:57 remote, seen in news:comp.lang.javascript,
Randy Webb <Hi************@aol.com> 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.
Apr 25 '06 #13

"Dr John Stockton" <jr*@merlyn.demon.co.uk> kirjoitti viestissä
news:mq**************@merlyn.demon.co.uk...
....
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?
Apr 25 '06 #14
Lasse Reichstein Nielsen said the following on 4/24/2006 2:01 AM:
Randy Webb <Hi************@aol.com> 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/
Apr 25 '06 #15
Dr John Stockton said the following on 4/25/2006 11:22 AM:
JRS: In article <K5******************************@comcast.com>, dated
Sun, 23 Apr 2006 21:02:57 remote, seen in news:comp.lang.javascript,
Randy Webb <Hi************@aol.com> 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/
Apr 25 '06 #16
optimistx said the following on 4/25/2006 3:29 PM:
"Dr John Stockton" <jr*@merlyn.demon.co.uk> kirjoitti viestissä
news:mq**************@merlyn.demon.co.uk...
....
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/
Apr 25 '06 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Richard Hollenbeck | last post by:
For example, one college course has only 24 students in it, but the following code says there are zero As, 20 Bs, 16 Cs, 4 Ds, and 8 Fs. When it prints it then says 0 As, 40 Bs, 32 Cs, 8 Ds, and...
6
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
2
by: Sam Miller | last post by:
Hi, I have a button event that won't fire. I left it on Friday and it worked fine. I came back in on Monday and it won't fire. I tried putting another button and just putting a...
8
by: Abul Hasan | last post by:
Hello everyone, I have placed simple validation through ErrorProvider Class on my textBoxes to check whether ther r empty or not Error Provider Class check and catches the error but it doesn't...
2
by: Ryan Liu | last post by:
Hi, I need the MouseDown event be trigged everytime when you press mouse in a datagrid (System.Windows.Forms). But seems mouse event will only fire once, and it seems changed to edit mode...
1
by: Mwob | last post by:
Hi, We have been using ADO and the AddNew method for a long time as a means to add records to the database. It has always worked fine - no problem. But - we recently started using INSERT...
9
by: ash | last post by:
i have got this question in old question papers and i know the answer but didn`t understand how it is possible. main( ) { int x=0; while(x<=50) for( ; ;) if( ++x % 50 ==0) break;
8
by: Devon Null | last post by:
I was wondering if there is a container (i.e. a vector) that can hold data structures of differing sizes. I was thinking of something along the lines of a container of classes. Think of a backpack...
3
by: goscottie | last post by:
I have two comboboxes databound at run time. I can make a selection on first one to filter the second one. This works good with applying DataView RowFilter on second combobox. But at that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.