Foros del Web » Creando para Internet » HTML »

Que hay mal en este codigo?

Estas en el tema de Que hay mal en este codigo? en el foro de HTML en Foros del Web. Errores segun http://validator.w3.org/check Código: Validation Output: 2 Errors 1. Error Line 1, Column 1: no document type declaration; will parse without validation <script src="http://widgets.twimg.com/j/2/widget.js"></script> The ...
  #1 (permalink)  
Antiguo 03/05/2010, 22:46
 
Fecha de Ingreso: julio-2008
Mensajes: 97
Antigüedad: 15 años, 9 meses
Puntos: 0
Que hay mal en este codigo?

Errores segun http://validator.w3.org/check

Código:
Validation Output: 2 Errors

   1. Error Line 1, Column 1: no document type declaration; will parse without validation

      <script src="http://widgets.twimg.com/j/2/widget.js"></script>


      The document type could not be determined, because the document had no correct DOCTYPE declaration. The document does not look like HTML, therefore automatic fallback could not be performed, and the document was only checked against basic markup syntax.

      Learn how to add a doctype to your document from our FAQ, or use the validator's Document Type option to validate your document against a specific Document Type.
Código:
   2. Error Line 2, Column 8: document type does not allow element "SCRIPT" here

      <script>

      ✉

      The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

      One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
Aca el Codigo que estoy probando.

Código HTML:
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 6,
  interval: 6000,
  width: 300,
  height: 250,
  theme: {
    shell: {
      background: '#383138',
      color: '#ffffff'
    },
    tweets: {
      background: '#dfe8f2',
      color: '#170317',
      links: '#3356e6'
    }
  },
  features: {
    scrollbar: true,
    loop: false,
    live: true,
    hashtags: true,
    timestamp: false,
    avatars: true,
    behavior: 'all'
  }
}).render().setUser('anime_golem').start();
</script> 
  #2 (permalink)  
Antiguo 03/05/2010, 22:56
Avatar de webosiris
Moderador egiptólogo
 
Fecha de Ingreso: febrero-2002
Ubicación: Luxor, Egipto
Mensajes: 10.725
Antigüedad: 22 años, 2 meses
Puntos: 998
Respuesta: Que hay mal en este codigo?

que es lo que estas intentando validar?
el error lo dice claramente el texto que tu mismo pegastes:
Cita:
The document type could not be determined, because the document had no correct DOCTYPE declaration
si lo que copiastes es todo tu codigo, te falta toda la estructura basica de un archivo html: Doctype, <html> <head> <body>....
__________________
Pasamos tus PSD a HTML

Pobre del que lo sabe todo, porque no tiene nada más que aprender ni razón para vivir. -
  #3 (permalink)  
Antiguo 04/05/2010, 22:42
 
Fecha de Ingreso: julio-2008
Mensajes: 97
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: Que hay mal en este codigo?

ya probe todas las formas posibles y siempre me da error, como deberia ponerlo?

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 6,
  interval: 6000,
  width: 300,
  height: 250,
  theme: {
    shell: {
      background: '#383138',
      color: '#ffffff'
    },
    tweets: {
      background: '#dfe8f2',
      color: '#170317',
      links: '#3356e6'
    }
  },
  features: {
    scrollbar: true,
    loop: false,
    live: true,
    hashtags: true,
    timestamp: false,
    avatars: true,
    behavior: 'all'
  }
}).render().setUser('anime_golem').start();
</script>
<body>
</body>
</html> 
Código:
   1.   Error  Line 7, Column 53: required attribute "type" not specified

      <script src="http://widgets.twimg.com/j/2/widget.js"></script>

      ✉

      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 7, Column 53: document type does not allow element "script" here; assuming missing "body" start-tag

      <script src="http://widgets.twimg.com/j/2/widget.js"></script>

      ✉
   3. Error Line 8, Column 8: required attribute "type" not specified

      <script>

      ✉

      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>.
   4. Error Line 38, Column 6: document type does not allow element "body" here

      <body>

      ✉

      The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

      One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
   5. Error Line 40, Column 7: end tag for "body" omitted, but OMITTAG NO was specified

      </html>

      ✉

      You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
   6. Info Line 7, Column 1: start tag was here

      <script src="http://widgets.twimg.com/j/2/widget.js"></script>
  #4 (permalink)  
Antiguo 04/05/2010, 23:31
Avatar de ipraetoriux  
Fecha de Ingreso: abril-2010
Ubicación: ipraetoriux.com
Mensajes: 1.125
Antigüedad: 14 años
Puntos: 155
Respuesta: Que hay mal en este codigo?

Mira yo en mi web lo tengo asi, y me valida perfectamente la W3C ...

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
  #5 (permalink)  
Antiguo 04/05/2010, 23:34
Avatar de flpespinoza  
Fecha de Ingreso: mayo-2010
Ubicación: El Grullo, Jalisco
Mensajes: 3
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: Que hay mal en este codigo?

hola amigo creo que tu error esta en que no has declarado de que tipo es el script
que tienes creo que deberia ir asi
<script src="http://widgets.twimg.com/j/2/widget.js" type="text/javascript"></script>

creo que esa es la solucion a tu problema, espero haberte podido ayudar
  #6 (permalink)  
Antiguo 04/05/2010, 23:54
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Que hay mal en este codigo?

Golem:
Parte del problema radica en lo que te señala flpespinoza en el post anterior, pero lo más grave, y esto merece un reto por lo menos, es que has dejado el javascript de tu página, en algo asi como en el "limbo"...

</head>
Tus scripts....
<body>


Te das cuenta
haz la llamada al javascript externo dentro del head y ubica dentro del body, donde corresponda. tu otra script.

Trata de analizar los mensajes del validador, que suelen ser muy explicitos, antes de postear
Saludos
  #7 (permalink)  
Antiguo 05/05/2010, 00:12
Avatar de flpespinoza  
Fecha de Ingreso: mayo-2010
Ubicación: El Grullo, Jalisco
Mensajes: 3
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: Que hay mal en este codigo?

esto que dice emprear es algo muy importante, recuerda que debes declarar dentro de la etiqueta head todo aquello que incluirás en tu página como hojas de estilo, javascript ,etc. Yo te recomiendo que hagas un archivo que contenga todas tus funciones javascript y lo enlaces a tu html ,asi como de los css, php, veras que tienes un mejor control de lo que estas realizando.

Etiquetas: mal
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:39.