关于小数转换成度分秒的问题
程序代码:
function change(jwd){ var str = jwd; var i = str.indexOf('.'); var strDu = str.substring(0,i); // 取0到小数点间的子串 var strFen = "0" + str.substring(i); // 得到字符串 0.xxxxxxxx var strMiao = ""; var Fen = strFen * 60; i = Fen.indexOf('.'); strFen = Fen.substring(0,i); strMiao = "0" + Fen.substring(i); var Miao = strMiao * 60; i = Miao.indexOf('.'); Miao = Miao.substring(0,i); var dfm = strDu + "°" + strFen+ "\'" + Miao+ "\""; return dfm; }
调用这个函数没有效果,自己找不出问题在哪,希望得到大家帮助!