function toHex(num){
  var rs = "";
  var temp;
  while(num/16 > 0){
    temp = num%16;
    rs = (temp+"").replace("10","a").replace("11","b").replace("12","c").replace("13","d").replace("14","e").replace("15","f") + rs;
    num = parseInt(num/16);
  }
  console.warn(rs);  //打印
  return rs;
}
 

备注:以上就是10进制转16进制的js了,求红色代码的正则表达式!!!

posted on 2013-03-29 18:53  双面煎蛋  阅读(4835)  评论(0编辑  收藏  举报