javascript - How can I change global variable when it's showed in an HTML page? -


the global variable called "gv" own original value. , when call function clicking buttons in html page, gv changed. then, want show gv in html page calling alert() or else. gv has no change. how can this?

the "best" way create global add "window." in front of variable.

window.gv = 0;  function testone() {     window.gv = 'hi !'; }  testone();  settimeout(function () {     alert(window.gv); }, 500); 

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 -