Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / July 2007



Tip: Looking for answers? Try searching our database.

object expected - huh?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
roN - 18 Jul 2007 23:35 GMT
Hi,

I'm trying a simple thing, trying to call this:
<script language="text/javascript">
<!--
function rating(){
 alert(document.Form.00N30000000h5OG.value);
 var capital=document.Form.00N30000000h5OG.value;
//  alert(capital);
//  document.write("rating: ");
 }
 //-->
</script>

out of this:
<input  id="00N30000000h5OG" value="<? echo $_POST['00N30000000h5OG']?>"
maxlength="20" name="00N30000000h5OG" size="20" type="text"
onkeyup="javascript:rating()"/>

But it returns "object expected" and i have no clue why... been looking
around for a while but haven't found anything.
Help would be kindly appreciated!
Thank you!
Ron
David Mark - 19 Jul 2007 00:54 GMT
> Hi,
>
[quoted text clipped - 14 lines]
> maxlength="20" name="00N30000000h5OG" size="20" type="text"
> onkeyup="javascript:rating()"/>

Get rid of the "javascript:" prefix in the onkeyup handler.  It doesn't
belong there.
Lee - 21 Jul 2007 17:27 GMT
David Mark said:

>> Hi,
>>
[quoted text clipped - 17 lines]
>Get rid of the "javascript:" prefix in the onkeyup handler.  It doesn't
>belong there.

It doesn't hurt anything.  The javascript parser considers
it to be a statement label which has no special meaning.

We haven't seen anything to convince us that the name of the
form is actually "Form".
Also note that values of the attribute NAME should begin with
an alphabetic character.

--
Richard Cornford - 22 Jul 2007 04:35 GMT
<snip>
>>> <input  id="00N30000000h5OG"
>>> value="<? echo $_POST['00N30000000h5OG']?>"
>>> maxlength="20" name="00N30000000h5OG" size="20" type="text"
>>> onkeyup="javascript:rating()"/>
<snip>
> Also note that values of the attribute NAME should begin
> with an alphabetic character.

Only in this case where the NAME attribute is (and should be) the same
as the ID attribute. NAME attributes are CDATA (except on META elements
where they are NAME tokens) and may contain any sequence of characters
"from the document character set" (as the HTML 4.01 specification puts
it). ID attributes are ID tokens and so begin with the upper or lower
case A-Z.

Richard.
Thomas 'PointedEars' Lahn - 31 Jul 2007 15:36 GMT
> David Mark said:
>> Get rid of the "javascript:" prefix in the onkeyup handler.  It doesn't
>> belong there.
>
> It doesn't hurt anything.

With for this point strictly ECMAScript Ed. 3 conforming script engines,
which are known to not exist.

> The javascript parser considers it to be a statement label
> which has no special meaning.

Not true.  It has a special meaning in MSHTML, although a seldom-used
one, as JavaScript, or rather JScript, is its default scripting language.

> We haven't seen anything to convince us that the name of the
> form is actually "Form".

Pluralis maiestatis?  DID?  Speak for your humble self only, please.

> Also note that values of the attribute NAME should begin with
> an alphabetic character.

Not true, they may begin with an underscore, too.

PointedEars
Signature

Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not the
best source of advice on designing systems that use javascript.
  -- Richard Cornford, <f806at$ail$1$8300dec7@news.demon.co.uk>

Michael White - 21 Jul 2007 01:13 GMT
> Hi,
>
[quoted text clipped - 14 lines]
> maxlength="20" name="00N30000000h5OG" size="20" type="text"
> onkeyup="javascript:rating()"/>

Try: alert(document.forms["00N30000000h5OG"].value);
Mick

> But it returns "object expected" and i have no clue why... been looking
> around for a while but haven't found anything.
> Help would be kindly appreciated!
> Thank you!
> Ron
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.