Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    xhtml : non mi valida...

    piccolo esempio

    codice:
    <!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" xml:lang="it">
    
    <head>
    	<title>Test</title>
    </head>
    
    <body>
    	
    
    123</p>
    	<script type="text/javascript">
    		document.write('ciao');
    	</script>
    	
    
    456</p>
    </body>
    
    </html>
    l'errore

    codice:
    Error  Line 18, Column 34: document type does not allow element "a" here
    
    		document.write('ciao');
    
    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).
    perchè a sarebbe dentro script?!

    grazie

  2. #2
    Codice PHP:
    <?xml version="1.0" encoding="UTF-8"?>
    <!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" xml:lang="it">

    <head>
        <title>Test</title>
    </head>

    <body>
        

    123</p>
        <script type="text/javascript">
        /*<![CDATA[*/
            document.write('[url="1.htm"]ciao[/url]');
        /*]]>*/
        </script>
        

    456</p>
    </body>

    </html>

  3. #3
    giusto, grazie... mi ero completamente dimenticato

  4. #4
    Tieni conto che, inoltre, la cattiva abitudine di utilizzare i commenti "" negli script nello standard XHTML si traduce con la mancata esecuzione del codice.
    Ricordati sempre di specificare anche il character encoding (necessario).

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.