Dreamweaver shows errors are defined but never used, is not defined, use strict in JavaScript code

0

I have a JS for a tooltip that works but in dreamweaver it shows me the various errors

  

'showTooltip' is defined but never used
  Missing "use strict" statement
  'X' is not defined

The question is why these errors and how to correct them

/*
*
* Autor: Ivan Salas Corrales
* blog: http://programando-o-intentandolo.blogspot.com.es/
*
*/

function mostrarTooltip(elemento,mensaje){

    // Si no existe aun el tooltip se crea
    if (!document.getElementById(elemento.id+"tp") ){

        // Dimensiones del elemento al que se quiere añadir el tooltip
        anchoElemento = $('#'+elemento.id).width();
        altoElemento = $('#'+elemento.id).height();
        
        // Coordenadas del elemento al que se quiere añadir el tooltip
        coordenadaXElemento = $('#'+elemento.id).position().left;
        coordenadaYElemento = $('#'+elemento.id).position().top;

        // Coordenadas en las que se colocara el tooltip
        x = coordenadaXElemento + anchoElemento/2 + 20;
        y = coordenadaYElemento + altoElemento/2 + 10;

        // Crea el tooltip con sus atributos
        var tooltip = document.createElement('div');
        tooltip.id = elemento.id + "tp";
        tooltip.className = 'toolTip';
        tooltip.innerHTML = mensaje;
        tooltip.style.left = x + "px";
        tooltip.style.top = y + "px";

        // Añade el tooltip
        document.body.appendChild(tooltip); 
    }

    // Cambia la opacidad del tooltip y lo muestra o lo oculta (Si el raton esta encima del elemento se muestra el tooltip y sino se oculta)
    $('#'+elemento.id).hover(
        function(){
            tooltip.style.display = "block";
            $('#'+tooltip.id).animate({"opacity" : 1});

        },
        function(){
            $('#'+tooltip.id).animate({"opacity" : 0});
            setTimeout(
                function (){
                    tooltip.style.display = "none";
                }, 
                400
            );
            
        }
    );    
}
.toolTip {
	background: rgba(20,20,20,0.9) url('../img/info.gif') center left 5px no-repeat;
	border: 2px solid #87cefa;
	border-radius: 5px;
	box-shadow: 5px 5px 5px #333;
	color: #87cefa;
	font-size: 0.8em;
	padding: 10px 10px 10px 35px;
	max-width: 600px;
	position: absolute;
	z-index: 100;	
}

.toolTip {}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<p> Nunc et vulputate neque. Proin tincidunt, elit sed volutpat ornare, tortor nunc porta ipsum, ac pharetra metus magna ac dui. Fusce eu felis risus. Aliquam accumsan venenatis egestas. Morbi vel eros egestas lectus fringilla aliquet at sit amet odio. Aliquam sed sapien justo, non auctor turpis. Donec leo massa, accumsan eget iaculis ut, <span id="palabra1" onmouseover="mostrarTooltip(this,'<p> Praesent dui leo, sagittis at adipiscing eget, ornare sed lectus. </p>');">facilisis</span>


			<p> Duis tincidunt, elit non malesuada ornare, sapien tortor <span id="palabra2" onmouseover="mostrarTooltip(this,'Esta es una palabra');"/>fringilla</span> magna
    
asked by Daniel 01.05.2017 в 03:24
source

0 answers