0

我正在制作在线京都巴士路线。所以我在我的代码中有开始和结束自动完成。我的目标是编写代码来识别主要站点的组合并链接到(或播放)新的 html 文件。

这是我的 HTML 代码。…………

<body>
<div id = "buttons">
<h1> Kyoto Bus Map</h1>
<label for="autocomplete">start </label>
<input id="autocomplete" placeholder="where is your closest bus station?" />

<label for="autocomplete1">end</label> 
<input id="autocomplete1" placeholder="where would you like to go?" /> 
</div>

<script>
var source = [ {label: "kyoto Station"},
               {label: "Gion"},
               {label: "Kyoto Tower"}]; /*I also want my start input to wait until end input is filled.*/

var source1 = [ {value: "kyoto.html", label: "kyoto Station"},
           {value: "gion.html", label: "Gion"},
           {value: "tower.html", label: "Kyoto Tower"}];



$(document).ready(function() {
$("input#autocomplete").autocomplete({
    source: source,
    select: function( event, ui ) { 
        window.location.href = ui.item.value;
    }
});
});


$(document).ready(function() {
$("input#autocomplete1").autocomplete({
    source: source1,
    select: function( event, ui ) { 
        window.location.href = ui.item.value;
    }
});
});

</script>
</body>
........

谢谢!!!

4

0 回答 0