Vote count:
-3
I am writing a script to move a button when mouseover
, I wasted my 2 hours to figure out that If i include <!DOCTYPE html>
At beginning then The button will not move but If I remove it then the button moves well!
Here's my Code: index.html
<html>
<head>
<title>My First Page</title>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 style="position:absolute; left:220px; top:175px; width:auto; height:210px;">Are You a Bird? </h1>
<div id="By" style="position:absolute; left:285px; top:235px; width:210px;
height:210px;">
<input type="button" value=" YES " onclick="yes()" />
</div>
<div ID="Bn" style="position:absolute; left:360px; top:235px; width:210px; height:210px;">
<input type="button" value=" NO " onmouseover="foo()" />
</div>
</body>
</html>
script.js
var flag=1;
function foo(){
if(flag==1)
{
Bn.style.top=90;
Bn.style.left=500;
flag=2;
}
else if(flag==2)
{
Bn.style.top=90;
Bn.style.left=50;
flag=3;
}
else if(flag==3)
{
Bn.style.top=235;
Bn.style.left=360;
flag=1;
}
}
Why this <!DOCTYPE html>
is causing me trouble, Am i missing something , Or is <!DOCTYPE html>
EVIL?
asked 1 min ago
Is Evil?
Aucun commentaire:
Enregistrer un commentaire