0
<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編輯webaddress,到目前爲止,我已經得到了它的當前閱讀的IP的地址,並有一個表格輸入ip。輸入字符串轉換成URL - 使用HTML表單和javascript
此外,如果任何人有任何提示如何製造更多的IP格式將有所幫助。
是currentPageURL串固定的嗎?還是它改變了? – Greezer
我試圖得到它,所以輸入的IP可以放進currentPageURL,然後.php將在html中輸出。 – WherEmEweeD
嗨Greezer,它從輸入表單變爲ip – WherEmEweeD