RE: [PHP] JavaScript and PHP
| From: | Boyd, Todd M. | Date: | Fri, 16 May 2008 15:11:41 +0000 |
| Subject: | RE: [PHP] JavaScript and PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274430@lists.php.net to get a copy of this message | ||
> -----Original Message-----
8< snip!
> That's incorrect. A form will function perfectly well with only name=
> attributes, and no ids, and it's quite possible for JavaScript to
> address the form elements using only the names (in fact, it's easier
> than via the ids as there's a short syntax for it!).
>
> CSS and the DOM, however, use the ids as primary identifier, so use of
> either of those may demand the presence of ids.
8< snip!
True, you can access an input named "myInput" in a form named "myForm"
by simply writing:
document.myForm.myInput.value = "Hello!";
BUT... for CSS, it's also quite easy to reference something by name:
[name="myElement"]
{
color: blue;
font-size: 10pt;
}
Todd Boyd
Web Programmer