W3C home > Mailing lists > Public > www-html-editor@w3.org > January to March 2004

Conflict with xhtml 1.1 code when using javascript

From: Deborah D. Hester <dhester@utmem.edu>
Date: Fri, 20 Feb 2004 16:44:33 -0600
To: <www-html-editor@w3.org>
Message-ID: <000001c3f803$1c532ff0$a13ec084@dhester>

I am responsible for implementing and maintaining my departmental web
pages here at the U of Tennessee HSC. Each of my pages are validated
against the W3C XHTML 1.1 Strict standards. While researching a problem
I am having with a <form> tag, I called upon the W3school's assistance .
According to the example given for using the form object specifically as
it related to dropdown menus
(http://www.w3schools.com/js/tryit.asp?filename=tryjs_putdropdown), I
found the following example:

<script type="text/javascript">
function put()
{
option=document.forms[0].dropdown.options[document.forms[0].dropdown.sel
ectedIndex].text
txt=option
document.forms[0].favorite.value=txt
}
</script>

Followed by this between the <body> opening/closing tags:

<form>
<p>
Select your favorite browser:
<select name="dropdown" onchange="put()">
<option>Internet Explorer
<option>Netscape Navigator
</select>
</p>

In this example, the property name="dropdown", would not be considered
valid code according to the W3C XHTML 1.1 Strict standards since name is
no longer accepted. Knowing this, in my form I rewrote it as
id='dropdown', afterwhich the code validated using the W3C html
validator, however, with the name property the drop down menu no longer
works. I can put the name property back in and the dropdown menu works
perfectly, however, the validator no longer validates the code. What
do/can I do to achieve both requirements?

Having not been working with html but a little more than a year or so, I
rely very much on the tutorials of the w3schools and the validation of
the W3C. But in the example above, one contradicts the other. Please
adivse.

Sincerely, 

Deborah Hester

Deborah D. Hester
Program Coordinator
Office of Student Affairs
UT College of Medicine
Tel: (901) 448-5531 | Fax: (901) 448-5641/7085
http://www.utmem.edu/medicine/studentaffairs 
Received on Friday, 20 February 2004 17:51:25 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:39:52 UTC