simple javascript code does not run, no matter what browser
Hello there,
the code below is the finalshot from this video:
https://www.youtube.com/watch?v=_Szdctv38Ow
But even the more simple code till minute 2:55 doesnt run.
Its not that an error occures, just nothing happend, no matter what browser I use.
It Holds true for all other code examples I tried.
It Holds true even if I call the html doc with its path (like: C:/User/name...) believing maybe neatbeans blocks the js code.
I use neatbeans on windows 10, and on win7 (this one is free of any antivirus software).
So, if any of you can tell me whats the reason, that would be nice.
Thanks, matthias
Code:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<script type ="text/javascript">
function addListeners()
{
if (window.addListeners)
{
document.getElementById('mybtn').addEventListener("click", btn1func, false);
}
else if(window.attachevent)
{
{
function btn1func(){
alter(this.id+" : mouse-click makes script run" );
}
}
}
window.onload = addListeners;
</script>
</head>
<body>
<button id="mybtn">MyButton</button>
</body>
</html>