Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Small javascript problem passing variables, Code inside. Please assist.

$
0
0

I have the javascript below, the weird thing is it just stopped working this morning. When I try to set the field "new_seconds", I always get a 0. I've declared a global variable so I should be able to pass paramteres between functions but I always get a 0. I don't know what went wrong this morning.

var i = 1;
var MSeconds = 0;

function onLoad() {

    _Timer();
}

function _Timer () {  
   setTimeout(function () { 
      MSeconds = MSeconds + 1; 
      alert(MSeconds);
      i++;                
      if (i > 0) { 
         _Timer();        
      }                        
   }, 1000)
}

function onSave() {

    Xrm.Page.data.entity.attributes.get("new_seconds").setValue(MSeconds);
}

Anyone know how to fix this?


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>