-4
我在Internet上找到了以下腳本。如何在沒有點擊的情況下自動轉到url地址
如何更改代碼,以便在單擊Open
按鈕時,它會去地址lnk.href
("https://www.google.si/maps/place/ljubljana" + userInput;
)
<body>
<script type="text/javascript">
function changeText2(){
var userInput = document.getElementById('userInput').value;
var lnk = document.getElementById('lnk');
lnk.href = "https://www.google.si/maps/place/ljubljana" + userInput;
lnk.innerHTML = lnk.href;
}
</script>
Type the location and click Open! <a href="" id=lnk>link</a> <br>
<input type='text' id='userInput' value='' />
<input type='submit' onclick='changeText2()' value='Open'/>