On 2 oct, 10:24, RCGUA <stv.nels...@gmail.com> wrote:
> Funny, this code below doesn't validate but it works perfectly
It may not work perfectly in all browsers and browser versions. To
make sure of that, you would have to use valid markup code, css code,
etc.
> and it
> is simple and easy to read and demonstrates the concept without
> cluttering the code with garbage like:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
Whenever there is a problem (layout, style, behavior, etc.) with a
webpage, rational, reasonable and experienced web developers first
start checking the validity of the markup code. Simply, there is
nothing better to do first. Then, they check the validity of the CSS
code. Then javascript errors, if any, in the console. It's best to
trigger stnadards compliant rendering mode in all browsers: you do not
do this. Instead, you say "cluttering the code with garbage like ..".
Even javascript debugging tools work as expected, accordingly when the
markup code and CSS code are valid.
"It is useless to start debugging a page when the HTML is not valid."
http://css.tests.free.fr/en/html_validation.php
"Validation may reveal your problem. Many cases of 'it works in one
browser but not another' are caused by silly author errors."
http://diveintomark.org/archives/200..._wont_help_you
> <script type="text/javascript">
> function changeValue(dropdown)
> {
> document.Test.TypeOfCarChosen.value = dropdown.value;}
>
> </script>
Did you read the comp.lang.javascript FAQ on how to get the value of a
form control?
comp.lang.javascript FAQ
8.1 How do I get the value of a form control?
http://jibbering.com/faq/#formControlAccess
How to reference form and form controls:
http://www.javascripttoolbox.com/bestpractices/#forms
> </head>
>
> <form name="Test" method="post" action="mailto:m...@mail.com">
> <select name="cars" onchange="changeValue(this)">
> <option value="volvo">Volvo</option>
> <option value="saab">Saab</option>
> <option value="audi">Audi</option>
> </select>
>
> <input type=hidden name="TypeOfCarChosen" value="?????" size="20">
Why is that input hidden? Just asking.
>
> <INPUT TYPE=submit VALUE="Validate it!">
> </form>
>
> </body>
> </html>
Gérard