Jump to content

strelok2014

Neophyte
  • Posts

    1
  • Joined

  • Last visited

Everything posted by strelok2014

  1. Помогите разобраться пожалуйста... Работает везде кроме IE8 и ниже <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>Основы языка JavaScript. Документы. Упражнение 4</title> </head> <body> <div id="cell" style="border: 1px #a0a0a0 solid; background-color: #efefef; width:40px;height:40px;text-align:center;" onmousedown="down(this,event)">0</div> <script type="text/javascript"> var x=0,drag=false; function down(obj,e){ x=e.clientX; obj.style.backgroundColor="#ddffdd"; document.addEventListener("mousemove",move,true); document.addEventListener("mouseup",up,true); drag=true; } function up(e){ var obj=document.getElementById("cell"); obj.style.backgroundColor="#efefef"; drag=false; } function move(e){ if (drag){ var obj=document.getElementById("cell"); var dx=Math.round((e.clientX-x)/10); obj.innerHTML=parseInt(obj.innerHTML)+dx; } } </script> </body>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy