HomeОбразованиеRelated VideosMore From: Rza Huseyin

JavaScript addEventListener

2 ratings | 119 views
var div=document.createElement('div'); div.style.height='100vh'; document.body.appendChild(div) div.addEventListener('mousemove', function(event){ console.log(event); var x=event.clientX; var y=event.clientY; div.textContent=x+', '+y; div.style.backgroundColor='rgb('+x+', ' +y+ ',100)'; })
Html code for embedding videos on your blog
Text Comments (0)

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.