+ 2
I am not able to see the alert pop up window ..why??
<button onclick ="alert()">explore</button> <script> function alert () { document.getElementbyId("demo").innerHTML =alert(); } </script> <p id ="demo"> </p>
3 ответов
+ 6
Spelling of getElementById is wrong(b in by should be capital)
You named the function alert and it calls itself and thus keeps on calling itself and after a specific no of iterations, it the interpreter gives error.
You overrided the alert function (the one that should show a pop up box) with a function you created now it cant call the original alert.
Why are you doing this :
document.getElementById("demo").innerHTML=alert();
The function you defined does not return anything and the original alert function also does not return anything. After fixing the above bugs also, undefined will be written to the p with id demo.
+ 2
change the function from alert to something else...^_^
+ 1
ty swapnil