简体   繁体   中英

windows.location.href doesn't work

I have a little trouble with javascript.

This is the search box :

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

This is the script :

<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>

When do a javascript alert, it appears well, but I cant go to URL.

它应该是window ,而不是windows

window.location.href = ....

您应该能够只执行window.location =“ ....”;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM