<button onclick="funk(0);">Click!</button> <script> function funk(n){ alert("n = " + n); var p = n; alert("p = " + p); } </script>