[Javascript] onFocus getting error.

BEKIM BACAJ trojani2000 at hotmail.com
Tue Jan 28 16:36:49 CST 2003


Sorry, the code looks clean, don't understand thow, what:  current.select;  
stands for? But the code is limiting the numchars
as you stated with no error of any kind.

The onFocus event is not causing the error, your error is caused
somewhere else in the document, some baldy nested tags, unclosed tag,
ID conflict, semicolon char (;) in the wrong place etc. -But not this code.
The error is organicaly related with this function and the object that calls 
it.

onFocus='javascript:gotMe(this, 6);' consider this way:
onFocus='gotMe(this, 6)' of invoking the functions (except in
inline functions of <A> tags)!

And of course, try replacing the script code content from the bottom of the 
page to the top of it. If you call the nonexisting function you will always 
get the 'object expected' error.

If the line error coincidates with the first line of the statement
current.maxLen...
than the problem is of the different nature and it has be connected with the 
wrong HTML syntax not the script itself.
Salutations!



>From: "Craig Gardner" <CGardner at JohnBurnham.com>
>Reply-To: javascript at LaTech.edu
>To: <javascript at LaTech.edu>
>Subject: [Javascript] onFocus getting error.
>Date: Mon, 27 Jan 2003 11:15:57 -0800
>
>Here's the function call:
>---function call ---
><input type='textarea' onFocus='javascript:gotMe(this, 6);'>
>
>Here's the function:
>--- function code ---
>    function gotMe(current, length)
>    {
>     current.maxLength = length;
>     current.select;
>    }
>
>The error that I'm getting says that there's an error on the function call
>line:
>--- error message ---
>Line:    112
>Char:    1
>Error:    Object expected
>Code:    0
>
>Does anyone have any ideas?  The only way that I've found that fixes this
>problem is getting rid of the onFocus part.  Even commenting the entire
>function body doesn't fix it.


_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail




More information about the Javascript mailing list