var currentPageURL = "www.javascript.com/dun/1.70 80";
var url = getMeasurementsFromUrl(currentPageURL)
document.write(url);
function getMeasurementsFromUrl(url)
{
var urlMeasurmentString = url.substring(url.lastIndexOf('/dun/')+5);
urlMeasurmentString =urlMeasurmentString.replace("abcdefghijklmnopqrstuvwxyz","");
urlMeasurmentString =urlMeasurmentString.replace(",",".");
urlMeasurmentString =urlMeasurmentString.replace("/",".");
urlMeasurmentString =urlMeasurmentString.replace("-",".");
urlMeasurmentString =urlMeasurmentString.replace(",",".");
urlMeasurmentString =urlMeasurmentString.replace("/",".");
urlMeasurmentString =urlMeasurmentString.replace("-",".");
return urlMeasurmentString;
}
我需要将输出“1.70 80”拆分为两个单独的整数。 http://jsfiddle.net/mqWGm/