Nu am avut nevoie sa imi bag nasul prea adanc in HTML de foarte mult timp (vreo 9 ani) asa ca sunt practic extrem de incepator in acest moment, dar tocmai am dat de o chestie mai ciudata si incerc sa ii dau de cap. Se da urmatoarea pagina:
Scopul: deschid aceasta pagina, e in engleza. Am in pagina o lista de selectie cu 3 limbi, aleg una, ma trimite pe pagina limbii respective in care continutul e in acea limba.
Problema: W3C validator da 3 erori.
1.
2.
3.
Apoi, pagina pare sa functioneze bine in Firefox si Opera si IE 9 fara compatibility mode, dar pusa pe server in IE8 sau IE9 nu mai apare lista de selectie, apare formul dar nu reactioneaza la click (nu deschide lista).
Sugestii?
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HEAD><TITLE>Test</TITLE><SCRIPT type="text/javascript">
function setdef()
{
document.languageForm1.languageLinks1.selectedIndex = 1;
}
function disp_text()
{
{
var w = document.languageForm1.languageLinks1.selectedIndex;
var selected_text = document.languageForm1.languageLinks1.options[w].text;
window.location=document.languageForm1.languageLinks1.options[document.languageForm1.languageLinks1.selectedIndex].value
}
return false;
}
</SCRIPT><HEAD>
<BODY onLoad=setdef()>
<TABLE width="100%" align=right>
<TBODY><TR><TD align=right>Choose your Preferred Language
<FORM name=languageForm1><SELECT onchange=disp_text() name=languageLinks1>
<OPTION value="/languages/CN.htm">Chinese
<OPTION value="/languages/EN.htm">English
<OPTION value="/languages/FR.htm">French
</OPTION></SELECT></FORM>
...continut HTML chior ...
Problema: W3C validator da 3 erori.
1.
Code:
Line xx, Column 20: an attribute value must be a literal unless it contains only name characters<BODY onLoad=setdef[COLOR="#FF0000"]([/COLOR])>
You have used a character that is not considered a "name character" in an attribute value. Which characters are considered "name characters" varies between the different document types, but a good rule of thumb is that unless the value contains only lower or upper case letters in the range a-z you must put quotation marks around the value. In fact, unless you have extreme file size requirements it is a very very good idea to always put quote marks around your attribute values. It is never wrong to do so, and very often it is absolutely necessary.
Code:
Line xx, Column 27: required attribute "ACTION" not specified <FORM name=languageForm1[COLOR="#FF0000"]>[/COLOR]<SELECT onchange=disp_text() name=languageLinks1>
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>.
Code:
Line xx, Column 54: an attribute value must be a literal unless it contains only name characters <FORM name=languageForm1><SELECT onchange=disp_text[COLOR="#FF0000"]([/COLOR]) name=languageLinks1>
You have used a character that is not considered a "name character" in an attribute value. Which characters are considered "name characters" varies between the different document types, but a good rule of thumb is that unless the value contains only lower or upper case letters in the range a-z you must put quotation marks around the value. In fact, unless you have extreme file size requirements it is a very very good idea to always put quote marks around your attribute values. It is never wrong to do so, and very often it is absolutely necessary.
Apoi, pagina pare sa functioneze bine in Firefox si Opera si IE 9 fara compatibility mode, dar pusa pe server in IE8 sau IE9 nu mai apare lista de selectie, apare formul dar nu reactioneaza la click (nu deschide lista).
Sugestii?