javascript - The Mathematical Operators not working on window.innerWidth -


when use mathematical operators window.innerwidth returs nan.

i tried add numeric 1 window.innerwidth.
what's wrong code?

  <body>    <p>click button display window's height , width (not including toolbars , scrollbars).</p>  <button onclick="myfunction()">try it</button>  <p id="demo"></p>  <script> function myfunction() {     var w = window.innerwidth;     var h = window.innerheight;     x = document.getelementbyid("demo");     x.innerhtml = "width: " + w-1 + " heigth: " + h; } </script>   </body> 

view sample @ plunker

change innerhtml code as

x.innerhtml = "width: " + (w-1) + " heigth: " + h;

modify javascript code below

here modified plunker

function myfunction() {     var w = window.innerwidth;     var h = window.innerheight;     x = document.getelementbyid("demo");     x.innerhtml = "width: " + (w-1) + " heigth: " + h; } 

stackoverflow reference '+' operator


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -