Jump to content

cannot get variable value


keat
 Share

Recommended Posts

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;
}
}
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...