[Javascript] onFocus getting error.

Peter Brunone peter at brunone.com
Mon Jan 27 16:58:28 CST 2003


MessageCraig,

    I see two definite problems here; there may be others, but this is just
off the top of my head.

1)  There is no need for the javascript pseudoprotocol.  This is only
necessary when you're calling a function from a link.  The correct syntax
would be onFocus="gotMe(this, 6);"

2)  As far as I know, there is no input type called textarea.  There is an
input type text, and a textarea object (which I don't believe has a
maxlength property).

    Which line is 112?  If you still have problems, knowing exactly where
the error is being thrown will help tremendously.

Cheers,

Peter

  -----Original Message-----
  From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Craig Gardner
  Sent: Monday, January 27, 2003 1:16 PM
  To: javascript at LaTech.edu
  Subject: [Javascript] onFocus getting error.


  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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20030127/9869016e/attachment.htm>


More information about the Javascript mailing list