Line 25, Column 34: character "&" is the first character of a delimiter but occurred as data.
if(document.getElementsByTagName && document.getElementById){
Come lo evito questo errore di validazione?
Line 25, Column 34: character "&" is the first character of a delimiter but occurred as data.
if(document.getElementsByTagName && document.getElementById){
Come lo evito questo errore di validazione?
si ecco la porzione di codice
codice:<script type="text/javascript"> window.onload=function(){ if(document.getElementsByTagName && document.getElementById){ document.getElementById("nav").className="jsenable"; BuildList(); var vm=document.getElementById("p<%=vm%>"); vm.className="show"; } } </script>
hehe, benvenuto nel mondo dell' XHTML 1.1!
<script type="text/javascript">
window.onload=function(){
if(document.getElementsByTagName && document.getElementById){
document.getElementById("nav").className="jsenable ";
BuildList();
var vm=document.getElementById("p<%=vm%>");
vm.className="show";
}
}
</script>
Questo perché XHTML 1.1 accetta SOLO validi alberi XML come documenti pagina, quindi le & sole non gli piacciono.
devi usare la entitity corrispondente che è &amp;
cioè devo scrivere così?
if(document.getElementsByTagName & & document.getElementById){...
in questo modo però lo script non funziona più
mm hai ragione...
L'unica è mettere lo script in un file JS esterno alla pagina ed importarlo con il src del <script>
Ma possibile che non esiste un altro modo?
Devo per forza di cosa includere il codice in un file esterno?
vabbè, potresti riscriverlo:
<script type="text/javascript">
window.onload=function(){
if(document.getElementsByTagName){
if(document.getElementById){
document.getElementById("nav").className="jsenable ";
BuildList();
var vm=document.getElementById("p<%=vm%>");
vm.className="show";
}
}
}
</script>
http://forum.html.it/forum/showthrea...9#post11617449Originariamente inviato da maxcondor
Ma possibile che non esiste un altro modo?
Devo per forza di cosa includere il codice in un file esterno?
Cavicchi Andrea
Problemi con javascript, jquery, ajax clicca qui