functionReceive()
{
//alert(“InBufferCount::”+MSComm1.InBufferCount);
varinputvalue=MSComm1.Input;
if(inputvalue.indexOf(‘g’)》=0){
return;
}
//alert(inputvalue);
tmpWeight+=inputvalue.replace(‘-’,‘’);
if(tmpWeight.length》16)
{
if(tmpWeight.indexOf(‘000’))
{
varweight=trim(tmpWeight.substr(5,5));
if(weight.indexOf(‘0’)==0)
{
weight=weight.replace(“0”,“0.”)
}
SKDBedit7.value=weight;
tmpWeight=“”;
}
}
//alert(“InBufferCount::”+MSComm1.InBufferCount);
}
/*
varweight;
varmyArray=newArray();
functionGetWeight()
{
}
*/
functionserPortInit()
{
SKDBcombobox1.value=“COM4”;
SKDBcombobox2.value=“9600”;
SKDBcombobox3.value=“無NONE”;
SKDBedit5.value=“8”;
SKDBedit6.value=“1”;
//初始化創(chuàng)建MSComm1對象
uf_GetSerPortData();
}
functiontrim(str){//刪除左右兩端的空格
returnstr.replace(/(^s*)|(s*$)/g,“”);
}
functionltrim(str){//刪除左邊的空格
returnstr.replace(/(^s*)/g,“”);
}
functionrtrim(str){//刪除右邊的空格
returnstr.replace(/(s*$)/g,“”);
}
電子發(fā)燒友App







評論