2017-04-15 40 views
0

我有這樣的環節 - http://am3yar0ra.in/test.html?a=52.472565,13.457407,Name抓取鏈接HTML文本框

現在我需要的是看我的test.html文件,並添加A = 52.472565,13.457407,名稱到一個文本框,並自動更新值。

以便它可以通過以下方式檢測URL協議:Click Me !! in test.html


對不起,我的英語不好。會是一個很大的幫助。

<center><font size="40"><b>Test</b></font></center> 


<br><br><br> 

<a href="test://Name/52.472565,13.457407">Click Me!!</a><br> 

<br>Mouse Over Select Name: <b></b> 
<br><input type="text" style="height:20px;line-height:10px;color:green;" onclick="this.setSelectionRange(0, this.value.length);" size="25" value="Name" readonly=""> 

<br>Mouse Over Select Lat &amp; Lon: <b></b> 
<br><input type="text" style="height:20px;line-height:10px;color:green;" onclick="this.setSelectionRange(0, this.value.length);" size="25" value="52.472565,13.457407" readonly=""> 

<br>Mouse over to Select Data: <b></b> 
<br><input type="text" style="height:20px;line-height:10px;color:green;" onclick="this.setSelectionRange(0, this.value.length);" size="45" value="test://Name/52.472565,13.457407" readonly=""> 

找到了我正在尋找的答案。這麼做是PHP,但..

<?php 
$location = $_GET['a']; 
$locationSplit = explode(",", $location); 
$lat = $locationSplit[0]; 
$lng = $locationSplit[1]; 
$name = $locationSplit[2]; 
$fullLocation = $lat.",". $lng; 
// if latitude is between -90/-180 <= lat/lng <= 90/180 
// if (those checks are false) 
//  die(0) 
?> 
+0

您想根據'test.html的一個= 52.472565,13.457407,Name'更新輸入域或您要更新?基於輸入字段的url? – azs06

+0

我想用數據網址更新文本字段。 – Exceptional

+0

我其實自己找到答案。我只需分割數據並在文本字段中添加值。無論如何感謝您的迴應。 – Exceptional

回答

0

試試這個:

setInterval(change,1000/30); 
function change() { 
    var x = document.getElementById('change'); 
    x.setAttribute("onclick","location.href='test://Name/52.472565,13.457407'"); 
}  
+0

這沒有幫助 – Exceptional