none
onMouseOver event not displaying button dynamically (javascript)

    Pregunta

  • I am trying to display a button on a OnMouseOver event but for some reason its not showing up, what could I be doing wrong?

    Thanks in advance for help

    var lis = document.getElementsByTagName('li');
    var element = document.createElement('input');
    
    	element.type ="Button";
    	element.Text = "Edit";
    
    
    for (i=0; i<lis.length; i++){ 
        lis[i].onmouseover = function(){ 
          // alert(event.clientX+':'+event.clientY);
    	
    	 element.style.visibility = "Visible";
          	 element.onclick = function () {
    	alert("This is a test");
    	}
    	 this.style.backgroundColor = "red";
    
        }; 
        lis[i].onmouseout = function(){ 
          //alert('Mouse Out');
    	element.style.visibility = "Visible";
    	this.style.backgroundColor = "white";
    
        }; 
    } 
    


    martes, 13 de marzo de 2012 15:39

Respuestas

Todas las respuestas