Salve, io ho questo codice javascript per gestire un'etichetta a comparsa:
L'etichetta funziona bene, solo che sia firefox che browser mi dicono che:codice:<SCRIPT type="text/javascript"> var IE = document.all?true:false; var Coordinate = new Object; if (!IE) document.captureEvents(Event.MOUSEMOVE); document.onmousemove = getMouseXY; function cambia(layer,visibilita,codice) { if(document.getElementById(layer).style.visibility == 'hidden' && visibilita == 'visible') { document.getElementById(layer).style.left = Coordinate[0]; document.getElementById(layer).style.top = Coordinate[1]; if(codice != "") document.getElementById(layer).innerHTML = codice; document.getElementById(layer).style.visibility = 'visible'; } else if(document.getElementById(layer).style.visibility == 'visible' && visibilita == 'hidden') { document.getElementById(layer).style.visibility = 'hidden'; document.getElementById(layer).style.left = 0; document.getElementById(layer).style.top = 0; } } function getMouseXY(e) { if (IE) { // grab the x-y pos.s if browser is IE Coordinate[0] = event.clientX + document.body.scrollLeft; Coordinate[1] = event.clientY + document.body.scrollTop; } else { // grab the x-y pos.s if browser is NS Coordinate[0] = e.pageX; Coordinate[1] = e.pageY; } if (Coordinate[0] < 0) Coordinate[0] = 0; if (Coordinate[1] < 0) Coordinate[1] = 0; } </SCRIPT>
Come posso risolvere il problema?codice:Error: document.getElementById(layer) has no properties

Rispondi quotando