aspx ページと ajax autoCompleteExtender を持つ asp テキスト ボックス コントロールがあります。オートコンプリート リストから選択した要素に従って、ページを別のページにリダイレクトしたい。しかし、私が使用するとき
window.location()
何も起こらず、同じページが更新されるだけです。これが私のJavaScriptです。
<script type="text/javascript">
function selectCity() {
var str = document.getElementById('<%= txtSearchForDestination.ClientID %>').value;
var array = str.split(",");
var city = array[0].replace(/^\s\s*/, '').replace(/\s\s*$/, '');
city = city.replace(/ /g, "+")
var country = array[1].replace(/^\s\s*/, '').replace(/\s\s*$/, '');
country = country.replace(/ /g, "+")
window.location.href("City.aspx?city=" + city + "-" + country);
}
</script>
スクリプトは機能しています。
alert("City.aspx?city=" + 都市 + "-" + 国)
問題はない。しかし、そのページにリダイレクトしたいときは機能しません。私も試しました
window.location("http://www.google.com")
それもうまくいきません。
何が問題になる可能性がありますか?