<p><input name="form[ip]" id="ip" class="ip" type="text" value="Enter IP here" />
</p>
<p><input type="submit" value="Submit" /></p>
var currentPageURL = "http://api.hostip.info/get_html.php?ip=12.215.42.19&position=true";
var ip = getMeasurementsFromUrl(currentPageURL)
alert(ip);
function getMeasurementsFromUrl(ip)
{
var ipMeasurmentString = ip.substring(ip.lastIndexOf('ip=')+3);
ipMeasurmentString =ipMeasurmentString.replace("&position=true","");
ipMeasurmentString =ipMeasurmentString.replace(",",".");
ipMeasurmentString =ipMeasurmentString.replace("/",".");
ipMeasurmentString =ipMeasurmentString.replace("-",".");
ipMeasurmentString =ipMeasurmentString.replace(",",".");
ipMeasurmentString =ipMeasurmentString.replace("/",".");
ipMeasurmentString =ipMeasurmentString.replace("-",".");
ipMeasurmentString =
return ipMeasurmentString;
}
我正在尝试编辑网址,以便它读取输入的 ip,到目前为止,我已经让它读取地址中当前的 ip,并有一个表格来输入 ip。
此外,如果有人对如何使表单更具 ip 格式有任何提示,将会有所帮助。