JavaScript window.location.href无法在本地主机上运行

时间:2020-04-26 01:11:52

标签: javascript html css

我的网站有问题。 如果输入框(id textbox_text)中存在“ 333”,则网站应重定向到指定的url,但是什么也没有发生。 问题出在哪里?

    <script>
            function IsEmpty()
            {
            if(document.forms['frm'].textbox_text.value == "333")
             {
                window.location.href="martyna-lesniak.html";
            }
            else 
            {
                alert("Nieprawidłowe hasło!");
            }
        }
    </script>
    <div class="container">
        <form name="frm">
            <input type="password" name="password1" class="password-input" id="textbox_text" placeholder="Wpisz hasło">
            <input type="submit" name="submit" onclick="return IsEmpty();" value="Wysyłaj" class="button-input" />
        </form>
    </div>

3 个答案:

答案 0 :(得分:4)

致电select date, car_maker, count(*) from (select t*, lag(time) over (partition by car_maker, date order by time) as prev_time from t where test_result = 'positive' ) t where prev_time > time - interval 15 minute group by date, car_maker; 后,只需return false;

答案 1 :(得分:0)

如果您需要在其他文件夹中引用HTML,而您需要在该文件夹中放置资源(html)的实际html,则另一件事是有条件的,您可以将===设置为等于对象

答案 2 :(得分:0)

尝试一下

<script>
        function IsEmpty()
        {
        if(document.forms['frm'].textbox_text.value == "333")
         {

            window.location.href="martyna-lesniak.html";
            return false;
        }
        else 
        {
            alert("Nieprawidłowe hasło!");
        }
    }
</script>
<div class="container">
    <form name="frm">
        <input type="password" name="password1" class="password-input" id="textbox_text" placeholder="Wpisz hasło">
        <input type="submit" name="submit" onclick="return IsEmpty();" value="Wysyłaj" class="button-input" />
    </form>
</div>