javascript - square shape won't disappear when clicked on -
i don't know why shape won't disappear when clicked. wrote correct code down disappearing function. wrote code displays green square , should disappear when clicked not. here is:
<html> <head> <title>javascript</title> <style type="text/css"> #shape{ width:200px; height:200px; background-color:green; } </style> </head> <body> <div id ="shape"> oo </div> <script type="text/javascript"> var start=new date().gettime(); document.getelementbyid("shape").onclick=function(){ document.getelementbyid("shape").style.display="none"; var end=new date().gettime(); var time=end-start; alert(time); } </script> </body> </html>
i think has browser
your document.getelementbyid("shape").style.display="none";
on line 38 has changed document.getelementbyid("shape").style.display="none";
you have see error in browser js-console.
uncaught typeerror: document.getelementbyid not function
Comments
Post a Comment