Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] onFocus getting error.
- From: javascript@xxxxxxxxxx (Peter Brunone)
- Subject: [Javascript] onFocus getting error.
- Date: Mon, 27 Jan 2003 16:58:28 -0600
This is a multi-part message in MIME format.
------=_NextPart_000_0028_01C2C625.50AA8FC0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
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@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx]On
Behalf Of Craig Gardner
Sent: Monday, January 27, 2003 1:16 PM
To: javascript@xxxxxxxxxx
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.
------=_NextPart_000_0028_01C2C625.50AA8FC0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2>Craig,</FONT></SPAN></DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D566105322-27012003> <FONT =
face=3DArial=20
color=3D#0000ff size=3D2>I see two definite problems here; there may be =
others, but=20
this is just off the top of my head.</FONT></SPAN></DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2>1) There is no need for the javascript =
pseudoprotocol. This=20
is only necessary when you're calling a function from a link. The =
correct=20
syntax would be onFocus=3D"gotMe(this, 6);"</FONT></SPAN></DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2>2) As far as I know, there is no input type called =
textarea. =20
There is an input type text, and a textarea object (which I don't =
believe has a=20
maxlength property).</FONT></SPAN></DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2> Which line is 112? If you still have =
problems,=20
knowing exactly where the error is being thrown will help=20
tremendously.</FONT></SPAN></DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2>Cheers,</FONT></SPAN></DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2>Peter</FONT></SPAN></DIV>
<DIV><SPAN class=3D566105322-27012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> =
javascript-admin@xxxxxxxxxx=20
[mailto:javascript-admin@xxxxxxxxxx]<B>On Behalf Of </B>Craig=20
Gardner<BR><B>Sent:</B> Monday, January 27, 2003 1:16 PM<BR><B>To:</B> =
javascript@xxxxxxxxxx<BR><B>Subject:</B> [Javascript] onFocus getting=20
error.<BR><BR></FONT></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial =
size=3D2>Here's the=20
function call:</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial =
size=3D2>---function call=20
---</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial =
size=3D2><input=20
type=3D'textarea' onFocus=3D'javascript:gotMe(this, =
6);'></FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial =
size=3D2>Here's the=20
function:</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial size=3D2>--- =
function code=20
---</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial =
size=3D2> =20
function gotMe(current, length)<BR> =
{<BR> =20
current.maxLength =3D length;<BR> =20
current.select;<BR> }</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial size=3D2>The =
error that I'm=20
getting says that there's an error on the function call=20
line:</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial size=3D2>--- =
error message=20
---</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial=20
size=3D2>Line: 112</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial=20
size=3D2>Char: 1</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial=20
size=3D2>Error: Object expected</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial=20
size=3D2>Code: 0</FONT></SPAN></DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D256331119-27012003><FONT face=3DArial size=3D2>Does =
anyone have=20
any ideas? The only way that I've found that fixes this problem =
is=20
getting rid of the onFocus part. Even commenting the entire =
function=20
body doesn't fix it.</FONT></SPAN></DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0028_01C2C625.50AA8FC0--
- Follow-Ups:
- [Javascript] onFocus getting error.
- From: Cutter (JavaScript)
- [Javascript] onFocus getting error.
- References:
- [Javascript] onFocus getting error.
- From: Craig Gardner
- [Javascript] onFocus getting error.
- Prev by Date: [Javascript] Form validation question
- Next by Date: [Javascript] Java Script IE5+ on the Mac
- Previous by thread: [Javascript] onFocus getting error.
- Next by thread: [Javascript] onFocus getting error.
- Index(es):