onMouseOver event not displaying button dynamically (javascript)
-
13 Maret 2012 15:39
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"; }; }
Semua Balasan
-
13 Maret 2012 20:49
- Ditandai sebagai Jawaban oleh lmundia 13 Maret 2012 20:49
-
14 Maret 2012 4:52ModeratorHi Imundia,
I am glad to hear that you've got your issue resolved all by yourself.
Have a nice day,Leo Liu [MSFT]
MSDN Community Support | Feedback to us