Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/432.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/2/jquery/70.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 Html |使用jQuery设置href url_Javascript_Jquery_Html_Href - Fatal编程技术网

Javascript Html |使用jQuery设置href url

Javascript Html |使用jQuery设置href url,javascript,jquery,html,href,Javascript,Jquery,Html,Href,我想在指定的情况下加载html。例如,我们在网站上看到的signIn按钮仅在id和密码正确的情况下加载页面html <a class="btn btn-primary btn-lg" id="singIn" href="#" role="button">Sign In</a> 这是if/else语句的一部分,我想在这里加载我首先提到的本地html文件 我该怎么做?请让我知道。谢谢。试试这样的东西 $(this).attr('href', 'local url goe

我想在指定的情况下加载html。例如,我们在网站上看到的signIn按钮仅在id和密码正确的情况下加载页面html

<a class="btn btn-primary btn-lg" id="singIn" href="#" role="button">Sign In</a>
这是if/else语句的一部分,我想在这里加载我首先提到的本地html文件


我该怎么做?请让我知道。谢谢。

试试这样的东西

  $(this).attr('href', 'local url goes here');

尝试一个带有隐藏按钮的验证函数,用于实际提交:

$'[type=button]'。单击函数{ var valid=true; $。每个$'input'函数{ valid=valid&&$this.val.length>0; } 如果有效{ var位置http://www.rootdir.com/?user=“+$”输入“.get0.value; 位置+='&密码='+$'输入'.get1.value; 警报位置;
//window.location.href=location;请注意,由于JavaScript代码是在浏览器中下载和执行的,用户实际上可以在源代码中看到密码。我建议查看一些服务器端解决方案。我同意@PetrBela;您所描述的是我们称之为安全剧场的一个极端示例。除非您是st构建一个演示,你所描述的只是一个安全的哑剧。危险,威尔·罗宾逊!谢谢!这就是我要找的!很高兴它能帮上忙。
  $(this).attr('href', 'local url goes here');