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

    validator e tag <style>

    non riesco a risolvere questi due errori che mi dà il validator in relazione a questo codice:

    codice:

    codice:
     <STYLE type="text/css">
    .menutitle {
    	BORDER-RIGHT: #c0330e 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #c0330e 1px solid; PADDING-LEFT: 2px; FONT-WEIGHT: bold; MARGIN-BOTTOM: 2px; PADDING-BOTTOM: 2px; BORDER-LEFT: #c0330e 1px solid; WIDTH: 140px; CURSOR: pointer; COLOR: #c0330e; PADDING-TOP: 2px; BORDER-BOTTOM: #c0330e 1px solid; BACKGROUND-COLOR: #F08700; TEXT-ALIGN: center
    }
    .submenu {
    	MARGIN-BOTTOM: 0.5em
    }
    </STYLE>
    
    <SCRIPT type="text/javascript" language="JavaScript">
    
    if (document.getElementById){
    document.write('<style type="text/css">\n')
    document.write('.submenu{display: none;}\n')
    document.write('</style>\n')
    }
    
    function SwitchMenu(obj){
    	if(document.getElementById){
    	var el = document.getElementById(obj);
    	var ar = document.getElementById("masterdiv").getElementsByTagName("span");
    		if(el.style.display != "block"){
    			for (var i=0; i<ar.length; i++){
    				if (ar[i].className=="submenu")
    				ar[i].style.display = "none";
    			}
    			el.style.display = "block";
    		}else{
    			el.style.display = "none";
    		}
    	}
    }
    
    </SCRIPT>
    è il codice che mi genera il menu css e dopo quello ogni div che metto mi crea una sezione del menu..

    errori:

    #

    Line 152, column 22: document type does not allow element "STYLE" here

    <STYLE type="text/css">

    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).


    #

    Line 166, column 23: end tag for element "STYLE" which is not open

    document.write('</style>\n')

    The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

    If this error occured in a script section of your document, you should probably read this FAQ entry.

  2. #2
    il tag <style> va prima di </head>, mentre <script> è consigliabile metterlo dopo <body>
    FEDERIX.IT - [Pillola] GRAFICA DEI FORM

    ...ho ancora quella forza che ti serve, quando dici "Si comincia!"

  3. #3
    Perchè SCRIPT è meglio nel BODY?

    Io direi che forse è meglio inserirlo nella HEAD in modo tale da farlo caricare prima. Logico è che in questo caso ci si debba concentrare sull'ottimizzazione in funzioni.

  4. #4
    ho provato e nn mi funziona più il menù in quel modo..

  5. #5
    Sì, infatti nella head vanno messe le funzioni. Per mettere lì lo script dovresti cercare di ottimizzarlo in funzioni.

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 © 2025 vBulletin Solutions, Inc. All rights reserved.