PDA

View Full Version : validate styleswitch



altoyes
09-09-2007, 04:57 AM
1) Script Title: styleswitch

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm

3) Describe problem:

how would i validate styleswiitch?
this is the error output below
thankyou for your time
alto
---------------------------------------
Validation Output: 2 Errors

1. Error Line 328, Column 21: required attribute "action" not specified.

<form id="switchform">

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
2. Error Line 329, Column 47: there is no attribute "onChange".

ůme="switchcontrol" size="1" onChange="chooseStyle(this.options[this.selectedI


You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

Twey
09-09-2007, 05:40 AM
<form action="" id="switchform">and
onchange="chooseStyle(I would strongly advise against using XHTML, however. IE does not yet support XHTML and cannot display pages served as such. A lot of web designers have this terrible habit of writing XHTML and then serving it as HTML (with a text/html content-type). This, however, isn't HTML (yes, even if the validator says it is). What it is is invalid HTML, as bad as if your document didn't validate at all. Instead, I suggest you stick to HTML 4.01 Strict until IE gains XHTML support, or possibly drop support for IE and configure your server to send your XHTML as XHTML (with the application/xhtml+xml MIME type). Unfortunately, however, this often isn't an option on production sites.

tech_support
09-09-2007, 06:53 AM
I would strongly advise against using XHTML, however. IE does not yet support XHTML and cannot display pages served as such. A lot of web designers have this terrible habit of writing XHTML and then serving it as HTML (with a text/html content-type). This, however, isn't HTML (yes, even if the validator says it is). What it is is invalid HTML, as bad as if your document didn't validate at all. Instead, I suggest you stick to HTML 4.01 Strict until IE gains XHTML support, or possibly drop support for IE and configure your server to send your XHTML as XHTML (with the application/xhtml+xml MIME type). Unfortunately, however, this often isn't an option on production sites.

Then why does the W3C site use it?

Twey
09-09-2007, 07:07 AM
I presume they suppose the future cost of converting their site to XHTML to be greater than the current cost of having an essentially invalid site.