Name of Form Element begin with number

V

Viet

I have problem in retrieve a value of a form element that have name
begin with a number. For example, for this HTML code
<input type="text" name="0000ABC12345CD6789" id="0000ABC12345CD6789">
I got Javascript error at document.form.0000ABC12345CD6789.value

Thanks.
 
K

kaeli

I have problem in retrieve a value of a form element that have name
begin with a number. For example, for this HTML code
<input type="text" name="0000ABC12345CD6789" id="0000ABC12345CD6789">
I got Javascript error at document.form.0000ABC12345CD6789.value

Thanks.

Don't use the shortcut syntax if your elements begin with numbers or
special characters. It's not very cross-browser, anyway.

And I sure hope you didn't name your form "form"...

Sub your formname here.
document.forms["formname"].elements["0000ABC12345CD6789"].value

--
 
L

Laurent Bugnion, GalaSoft

Hi,
I have problem in retrieve a value of a form element that have name
begin with a number. For example, for this HTML code
<input type="text" name="0000ABC12345CD6789" id="0000ABC12345CD6789">
I got Javascript error at document.form.0000ABC12345CD6789.value

Thanks.

This is not legal HTML.

From the HTML 4.01 specs:
<quote>
# ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed by any number of letters, digits ([0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".").
</quote>

See the specs at
<URL: http://www.w3.org/TR/html401/types.html#type-cdata>

Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top