0

我对javascript有点麻烦。

这是搜索框:

<input id="lala" onkeypress="lala(event)" />

这是脚本:

<script type="text/javascript">
function lala(e){
    tecla = (document.all) ? e.keyCode : e.which;
    if(tecla==13) windows.location.href = 'http://server:100/Theme/resumenInstrumento.aspx?nemo=lan';
} 
</script>

当做一个 javascript 警报时,它看起来很好,但我不能去 URL。

4

2 回答 2

7

它应该是window,而不是windows

window.location.href = ....
于 2011-01-25T20:06:08.260 回答
2

你应该可以做 window.location = "....";

于 2011-01-25T20:07:43.413 回答