JavaScript window.location.href在本地主机中不工作
我的网站有问题。 当输入框(id textbox_text)中有“333”时,网站应该重定向到指定的url,但是什么也没有发生。 问题在哪里JavaScript window.location.href在本地主机中不工作,javascript,html,css,Javascript,Html,Css,我的网站有问题。 当输入框(id textbox_text)中有“333”时,网站应该重定向到指定的url,但是什么也没有发生。 问题在哪里 <script> function IsEmpty() { if(document.forms['frm'].textbox_text.value == "333") { window.location.hr
<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>
函数IsEmpty()
{
if(document.forms['frm'].textbox_text.value==“333”)
{
window.location.href=“martyna lesniak.html”;
}
其他的
{
警惕(“尼普拉维德·奥维有!”;
}
}
如果您在其他文件夹中有需要引用的HTML,则需要将实际HTML放入资源路径(HTML)中,另一件事是在条件中,您可以将===放入一个文本相等的对象您只需返回false调用window.location.href=“martyna lesniak.html”后,单击code>代码>试试这个
<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>
函数IsEmpty()
{
if(document.forms['frm'].textbox_text.value==“333”)
{
window.location.href=“martyna lesniak.html”;
返回false;
}
其他的
{
警惕(“尼普拉维德·奥维有!”;
}
}
使用window.location.replace(url)。Href仅适用于clickStill nothing:/Page,仅刷新