字串小寫 str.toLowerCase();
exp:
str="abCD";
str=str.toUpperCase();//str="ABCD"
str=str.toLowerCase();//str="abcd"
擷取IP Address
function iptrans()
{
// 十進位轉16進位
//function d2h(d) {return d.toString(16);}
IPstr=document.GE_MgrFrm. IPaddress.value;
var datePart = IPstr.match(/(\d{1,3}).(\d{1, 3}).(\d{1,3}).(\d{1,3})/);
p1=parseInt(datePart[2],10). toString(16);
p2=parseInt(datePart[3],10). toString(16);
p3=parseInt(datePart[4],10). toString(16);
if (parseInt(datePart[3],10) < 16)
p1='0' + p1;
if (parseInt(datePart[3],10) < 16)
p2='0' + p2;
if (parseInt(datePart[3],10) < 16)
p3='0' + p3;
document.GE_MgrFrm. Resultaddress.value = '01:00:5E:'+ p1.toUpperCase() +':'+ p2.toUpperCase() +':'+ p3.toUpperCase();
}
擷取MacAddress
function mactrans()
{
//16進位轉十進位
//function h2d(h) {return parseInt(h,16);}
MACstr=document.GE_MgrFrm. MACaddress.value;
//var datePart = MACstr.match(/([0-9a-f]{2})[:- ]([0-9a-f]{2})[:-]([0-9a-f]{2} )[:-]([0-9a-f]{2})[:-]([0-9a- f]{2})[:-]([0-9a-f]{2})/i);
var datePart = MACstr.match(/([0-9a-f]{1,2})[ :-]([0-9a-f]{1,2})[:-]([0-9a- f]{1,2})[:-]([0-9a-f]{1,2})[:- ]([0-9a-f]{1,2})[:-]([0-9a-f]{ 1,2})/i);
document.GE_MgrFrm. Resultaddress.value = '224.' + parseInt(datePart[4],16) +'.'+ parseInt(datePart[5],16) +'.'+ parseInt(datePart[6],16);
}