function padleft(input, ch, num) {
var val=input.value;
if (val.length<num) {
if(val){
var re = new RegExp(".{" + num + "}$");
var new_num=num*1-val.length;
var pad = "";
if (!ch) ch = " ";
do {
pad += ch;
}while(pad.length < new_num);
input.value=(pad+val);
}
}
}
沒有留言:
張貼留言