Jump to content
  • 0

Javascript не работает в IE


strelok2014
 Share

Question

Помогите разобраться пожалуйста... Работает везде кроме 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>

Edited by strelok2014
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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