|
Next: can't reset a hidden field in form
|
| Author |
Message |
External

Since: Aug 12, 2007 Posts: 3
|
(Msg. 1) Posted: Sun Aug 12, 2007 6:00 pm
Post subject: Object Expected Archived from groups: comp>lang>javascript (more info?)
|
|
|
What is wrong with the following code. Why is IE complaining that an
Object is required on line 26 char 1.
Thanks for any ideas.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>TITLE</title>
<script type="text/javascript">
<!--
function checkEmail() {
var regexp = /^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/;
if(document.getElementById("email").value.match(regexp) {
alert ("Email valid");
document.frm.submit();
return true;
} else {
alert ("Email Not valid");
return false;
}
}
//-->
</script>
</head>
<body>
<form action="http://www.yahoo.com" method="get" name="frm">
<label for="email">Email: </label><input type="text" size="30"
id="email" name="email" />
<input type="button" value="Submit" onclick="checkEmail();" />
</form>
</body>
</html> |
|
| Back to top |
|
 |  |
External

Since: Aug 24, 2004 Posts: 4981
|
(Msg. 2) Posted: Sun Aug 12, 2007 6:13 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Kaushal Shah said the following on 8/12/2007 6:00 PM:
> What is wrong with the following code. Why is IE complaining that an
> Object is required on line 26 char 1.
>
> Thanks for any ideas.
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
There is the first thing wrong with it. You are trying to feed IE a
document type that it has no clue that exists.
> <head>
> <title>TITLE</title>
> <script type="text/javascript">
> <!--
> function checkEmail() {
> var regexp = /^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/;
> if(document.getElementById("email").value.match(regexp) {
if (document.getElementById("email").value.match(regexp)){
You didn't close your if test. Open it in Firefox and view the error
console, it points straight at the error. The reason IE gives the error
it gives is because of the syntax error it doesn't defined checkEmail as
a function so - rightfully - complains that an object is expected.
Clicking the button in Firefox will give you the same error albeit
differently worded "checkEmail is not defined".
BTW, your alert message is incorrect as well. Instead of "Email Not
Valid" it should be "Email does not fit my criteria for a valid email
address".
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ |
|
| Back to top |
|
 |  |
External

Since: Aug 12, 2007 Posts: 3
|
(Msg. 3) Posted: Sun Aug 12, 2007 6:17 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Ok got it. Thanks.
Randy Webb wrote:
> Kaushal Shah said the following on 8/12/2007 6:00 PM:
>> What is wrong with the following code. Why is IE complaining that an
>> Object is required on line 26 char 1.
>>
>> Thanks for any ideas.
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>
> There is the first thing wrong with it. You are trying to feed IE a
> document type that it has no clue that exists.
>
>> <head>
>> <title>TITLE</title>
>> <script type="text/javascript">
>> <!--
>> function checkEmail() {
>> var regexp = /^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/;
>> if(document.getElementById("email").value.match(regexp) {
>
> if (document.getElementById("email").value.match(regexp)){
>
> You didn't close your if test. Open it in Firefox and view the error
> console, it points straight at the error. The reason IE gives the error
> it gives is because of the syntax error it doesn't defined checkEmail as
> a function so - rightfully - complains that an object is expected.
> Clicking the button in Firefox will give you the same error albeit
> differently worded "checkEmail is not defined".
>
> BTW, your alert message is incorrect as well. Instead of "Email Not
> Valid" it should be "Email does not fit my criteria for a valid email
> address".
> |
|
| Back to top |
|
 |  |
External

Since: Aug 12, 2007 Posts: 3
|
(Msg. 4) Posted: Sun Aug 12, 2007 6:24 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Randy Webb wrote:
> Kaushal Shah said the following on 8/12/2007 6:00 PM:
>> What is wrong with the following code. Why is IE complaining that an
>> Object is required on line 26 char 1.
>>
>> Thanks for any ideas.
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>
> There is the first thing wrong with it. You are trying to feed IE a
> document type that it has no clue that exists.
>
>> <head>
>> <title>TITLE</title>
>> <script type="text/javascript">
>> <!--
>> function checkEmail() {
>> var regexp = /^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/;
>> if(document.getElementById("email").value.match(regexp) {
>
> if (document.getElementById("email").value.match(regexp)){
>
> You didn't close your if test. Open it in Firefox and view the error
> console, it points straight at the error. The reason IE gives the error
> it gives is because of the syntax error it doesn't defined checkEmail as
> a function so - rightfully - complains that an object is expected.
> Clicking the button in Firefox will give you the same error albeit
> differently worded "checkEmail is not defined".
>
The email criteria need to be worked on at this point. I'll fix that
soon. Thanks for your reply.
> BTW, your alert message is incorrect as well. Instead of "Email Not
> Valid" it should be "Email does not fit my criteria for a valid email
> address".
> |
|
| Back to top |
|
 |  |
External

Since: Aug 08, 2007 Posts: 10
|
(Msg. 5) Posted: Sun Aug 12, 2007 7:19 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Kaushal Shah wrote:
> What is wrong with the following code. Why is IE complaining that an
> Object is required on line 26 char 1.
> Thanks for any ideas.
Try matching up your parentheses on the if statement. Pretty basic stuff. |
|
| Back to top |
|
 |  |
|
Thomas 'PointedEars' Lahn
|
External

Since: Sep 05, 2004 Posts: 3405
|
(Msg. 6) Posted: Sun Aug 12, 2007 7:19 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Kaushal Shah wrote:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <title>TITLE</title>
http://www.w3.org/QA/Tips/good-titles
> <script type="text/javascript">
> <!--
If you had any clue *why* you were using XHTML in the first place, you would
never ever try to comment out the `script' element content. Fortunately for
you, IE does not support XHTML, so it does not use an XML parser which would
be allowed to remove the entire PCDATA content of the element from the parse
tree and leave you with an empty <script/>.
http://hsivonen.iki.fi/xhtml-the-point/
That said, there is no working Web user agent that requires the contents of
the `script' element to be commented out. Support of it in some Web
browsers is merely a relic, one that should not be expected in all Web user
agents. Worst case: syntax error.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee |
|
| Back to top |
|
 |  |
External

Since: Aug 24, 2004 Posts: 4981
|
(Msg. 7) Posted: Sun Aug 12, 2007 7:19 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Thomas 'PointedEars' Lahn said the following on 8/12/2007 6:43 PM:
<snipped anything relevant and/or useful to the OP>
Then I realized nothing was left. The least you could have done in the
midst of your babbling was to at least try to answer the question.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ |
|
| Back to top |
|
 |  |
External

Since: May 21, 2007 Posts: 10
|
(Msg. 8) Posted: Mon Aug 13, 2007 6:55 am
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
"Randy Webb" <HikksNotAtHome.DeleteThis@aol.com> wrote in message
news:QrSdnQKIw-tBEiLbRVn_vw@giganews.com...
> Thomas 'PointedEars' Lahn said the following on 8/12/2007 6:43 PM:
>
> <snipped anything relevant and/or useful to the OP>
>
> Then I realized nothing was left. The least you could have done in the
> midst of your babbling was to at least try to answer the question.
>
> --
> Randy
> Chance Favors The Prepared Mind
> comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
> Javascript Best Practices -
> http://www.JavascriptToolbox.com/bestpractices/
OE on my computer has it that you had answered the question some 40 minutes
before.
I found the "babbling" useful.
I find lots of the babbling useful, thanks guys, and lots confusing, but it
does tell me very clearly that I am entering a "haunted forest".
I find most of the quibbling and in-fighting very distracting and
discouraging. With things to bite me all around I see my potential guides
guides and escorts continually wrestling with each other on the ground.
David F. Cox |
|
| Back to top |
|
 |  |
External

Since: Jun 09, 2004 Posts: 1556
|
(Msg. 9) Posted: Mon Aug 13, 2007 6:55 am
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
David Cox said:
>
>
>I find most of the quibbling and in-fighting very distracting and
>discouraging. With things to bite me all around I see my potential guides
>guides and escorts continually wrestling with each other on the ground.
Even though it may not produce the warm feeling of security that
you might like, you should find it reassuring to know that if a
guide gives you bad advice, another will not hesitate to speak up.
-- |
|
| Back to top |
|
 |  |
External

Since: Feb 24, 2007 Posts: 4
|
(Msg. 10) Posted: Mon Aug 13, 2007 2:51 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
"Kaushal Shah" <kshah11374 DeleteThis @yahoo.com> wrote in message
news:SIOdnX44Q49wHyLbnZ2dnUVZ_oqhnZ2d@rcn.net...
> What is wrong with the following code. Why is IE complaining that an
> Object is required on line 26 char 1.
>
> Thanks for any ideas.
>
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <title>TITLE</title>
> <script type="text/javascript">
> <!--
> function checkEmail() {
> var regexp = /^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/;
quotes are required for this string
var regexp = "/^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/"; |
|
| Back to top |
|
 |  |
External

Since: Jun 09, 2004 Posts: 1556
|
(Msg. 11) Posted: Mon Aug 13, 2007 2:51 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Tim B said:
>
>
>"Kaushal Shah" <kshah11374 RemoveThis @yahoo.com> wrote in message
>news:SIOdnX44Q49wHyLbnZ2dnUVZ_oqhnZ2d@rcn.net...
>> What is wrong with the following code. Why is IE complaining that an
>> Object is required on line 26 char 1.
>> var regexp = /^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/;
>
>quotes are required for this string
>var regexp = "/^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/";
No. It's not a string. It's a RegExp literal, and as such
is delimited by slashes, rather than quotes.
-- |
|
| Back to top |
|
 |  |
|
Thomas 'PointedEars' Lahn
|
External

Since: Sep 05, 2004 Posts: 3405
|
(Msg. 12) Posted: Mon Aug 13, 2007 5:25 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Tim B wrote:
> "Kaushal Shah" [...] wrote [...]:
>> What is wrong with the following code. Why is IE complaining that an
>> Object is required on line 26 char 1.
>> [...]
>> var regexp = /^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/;
>
> quotes are required for this string
That is *not* a string, it is an ECMAScript Edition 3 RegExp object
initializer which is supported since JScript 3.0 (IE 3.0, October 1997).
> var regexp = "/^[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]$/";
That *is* a string indeed, but it won't work as expected here, with
> if(document.getElementById("email").value.match(regexp)
^^^^^ ^
You are a little late; the reason, which was an omitted closing parenthesis
for the `if' statement, was found already in
<news:Z--dnSoocd5wGCLbRVn_vw@giganews.com> at Sun, 12 Aug 2007 18:13:58
GMT-0400.
Please trim your quotes more (see [1]) and provide a sender address that
complies with RFC2822 [2], subsection 3.4.1. Your Message-ID header is also
borken, the domain part has to be a FQDN (see RFC1036 [3], 2.1.5). Try
alt.test, maybe one or two bots will reply. [4]
HTH
PointedEars
___________
[1] http://www.jibbering.com/faq/faq_notes/clj_posts.html
[2] http://rfc-editor.org/rfc/rfc2822.txt
[3] http://rfc-editor.org/rfc/rfc1036.txt
[4] news:alt.test
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> |
|
| Back to top |
|
 |  |
External

Since: Aug 24, 2004 Posts: 4981
|
(Msg. 13) Posted: Mon Aug 13, 2007 5:25 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
Thomas 'PointedEars' Lahn said the following on 8/13/2007 11:25 AM:
> Tim B wrote:
>> "Kaushal Shah" [...] wrote [...]:
<snip>
>> if(document.getElementById("email").value.match(regexp)
> ^^^^^ ^
> You are a little late; the reason, which was an omitted closing parenthesis
> for the `if' statement, was found already in
> <news:Z--dnSoocd5wGCLbRVn_vw@giganews.com> at Sun, 12 Aug 2007 18:13:58
> GMT-0400.
Broken URL reference. YSCIB as well.
> Please trim your quotes more (see [1]) and provide a sender address that
> complies with RFC2822 [2], subsection 3.4.1. Your Message-ID header is also
> borken, the domain part has to be a FQDN (see RFC1036 [3], 2.1.5). Try
> alt.test, maybe one or two bots will reply. [4]
You just don't grasp reality real well do you?
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ |
|
| Back to top |
|
 |  |
External

Since: May 28, 2006 Posts: 213
|
(Msg. 14) Posted: Mon Aug 13, 2007 9:47 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
On Mon, 13 Aug 2007 at 17:25:14, in comp.lang.javascript, Thomas
'PointedEars' Lahn wrote:
<snip>
> provide a sender address that
>complies with RFC2822 [2], subsection 3.4.1.
But only if you want lots of spam.
>Your Message-ID header is also
>borken, the domain part has to be a FQDN (see RFC1036 [3], 2.1.5).
<snip>
Ignore that; it's out of date.
John
--
John Harris |
|
| Back to top |
|
 |  |
|
Thomas 'PointedEars' Lahn
|
External

Since: Sep 05, 2004 Posts: 3405
|
(Msg. 15) Posted: Mon Aug 13, 2007 11:13 pm
Post subject: Re: Object Expected Archived from groups: per prev. post (more info?)
|
|
|
John G Harris wrote:
> [...] Thomas 'PointedEars' Lahn wrote:
>> provide a sender address that
>> complies with RFC2822 [2], subsection 3.4.1.
>
> But only if you want lots of spam.
It is true and should be mentioned that a compliant sender address tends to
attract spammers. However, that does not mean necessarily that spam is
received by the corresponding mailbox.
It is also true and should be mentioned that not providing a compliant
sender address disregards Netiquette (as it forces off-topic discussions
like this), violates Internet standards and, last but not least, constitutes
a violation of the Terms of Use of many NetNews providers and therefore can
lead to account cancellation.
>> Your Message-ID header is also borken, the domain part has to be a FQDN
>> (see RFC1036 [3], 2.1.5).
> <snip>
>
> Ignore that; it's out of date.
Utter nonsense. Troll elsewhere.
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> |
|
| Back to top |
|
 |  |