Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/426.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';无法从电子邮件输入中获取值_Javascript_Html - Fatal编程技术网

Javascript Can';无法从电子邮件输入中获取值

Javascript Can';无法从电子邮件输入中获取值,javascript,html,Javascript,Html,我已经下载了一个模板表单,可以使用bootstrap登录。当我试图从email或password字段获取值时,什么都没有发生 这张照片看起来像这样 <form class="form-signin"> <img class="mb-4" src="https://getbootstrap.com/docs/4.3/assets/brand/bootstrap-solid.svg" alt="" width="72" height="72">

我已经下载了一个模板表单,可以使用bootstrap登录。当我试图从email或password字段获取值时,什么都没有发生

这张照片看起来像这样

   <form class="form-signin">
            <img class="mb-4" src="https://getbootstrap.com/docs/4.3/assets/brand/bootstrap-solid.svg" alt="" width="72" height="72">
            <h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
            <input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
            <input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
            <div class="checkbox mb-3">
                <label>
                    <input type="checkbox" value="remember-me"> Remember me
                </label>
            </div>
            <button onclick="autentica()" class="btn btn-lg btn-primary btn-block" type="submit" >Sign in</button>
        </form>

请登录
记得我吗
登录
我尝试使用的函数如下所示:

<script>
    function autentica(){
    var mail = document.getElementById("inputEmail").value();
    alert(mail);
    if(document.getElementById("inputEmail").value() == "admin@admin.cl" && document.getElementById("inputPassword").value() == "admin"){
        document.location.href= "dashboard.html";
  }
}
</script>


函数autentica(){
var mail=document.getElementById(“inputEmail”).value();
警报(邮件);
if(document.getElementById(“inputEmail”).value()admin@admin.cl&&document.getElementById(“inputPassword”).value()=“admin”){
document.location.href=“dashboard.html”;
}
}
警报和更改页面都不起作用。 “dashboard.html”文件位于同一文件夹中


提前感谢。

没有函数
value()
,但它是一个(字符串)属性
value
。因此正确的语法应该是:
var mail=document.getElementById(“inputEmail”).value

不要将值用作函数调用。移除圆括号。
什么都没有发生
不完全正确,控制台记录了一个错误:
类型错误:document.getElementById(…)。值不是函数
(另外,任何人都可以查看源代码并找到登录名/密码)我只是尝试更改页面,如果登录名/密码匹配,我去掉了圆括号,但仍然无法更改页面。是
document.location.href=“dashboard.html”正确吗?现在警报工作了,谢谢。只剩下一个问题:如何更改页面?代码不起作用。javascript上是否有“Equals()”函数?