keat Posted March 11, 2019 Share Posted March 11, 2019 Hi, i want to pass value from the HTML element to the type script variable , but when i write this.ShowMs(show), it show error of "Property 'ShowMs' does not exist on type 'HTMLElement'. Anyone know what i missing? Below is the code. ping():void{ var intStartTime; intStartTime = +new Date(); var objIMG = new Image(); var show; objIMG.src = this.url + "/" + intStartTime ; objIMG.onload = objIMG.onerror = function() { var delay = Number(new Date()) - Number(intStartTime); show = (delay<1)?("<1"):(" = "+delay); console.log( " Ping" + show + " ms"); this.ShowMs(show); } } ShowMs(passData:any):void{ if(passData < 100){ this.txt.color = "#3FFF00"; this.txt.text = passData; }else if(passData < 300){ this.txt.color = "#C5FF0D"; this.txt.text = passData; }else if(passData > 300){ this.txt.color = "#FF0000"; this.txt.text = passData; }else{ this.txt.color = "#FF0000"; this.txt.text = passData; } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.