Código:
Cuando acudo al validador de xhtml me da errores tales como:<script type="text/javascript"> function camposobligatorios(clase,obligatorio,valor,elemento_formulario){//para mejorarlo falta pasar un mensaje personalizado por cada error producido array=document.getElementsByTagName(elemento_formulario); for(p=0;p<array.length;p++){ if(array[p].className.length && array[p].className==clase){ x=p+1; if(x<array.length && array[x].className.length && array[x].className==obligatorio && array[x].value==valor && cadenaVacia(array[p].value)){//el el primer parámetro de la condición nos aseguramos de no pasarnos de vuelta en el bucle alert(getvalue('obligatory')); array[p].focus(); return false; } } } return true; } function comprobar(){ if(camposobligatorios('campo','obligatorio','1','input')){ putvalue('connection','on'); formsubmit('form1'); } } </script>
# Line 16, Column 24: character ";" not allowed in attribute specification list
for(p=0;p<array.length;p++){
✉
# Error Line 16, Column 24: element "array.length" undefined
for(p=0;p<array.length;p++){
✉
You have used the element named above in your document, but the document type you are using does not define an element of that name. 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 "Frameset" document type to get the "<frameset>" element),
* by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
* by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).
El script lo tengo entre los head y lo confunde con etiquetado html ????