为什么不起作用,跳转不过去
把代码贴出来,不然怎么回答你
哥们你的代码呢???
你用的类型是 type="submit"啊,只能用来提交form表单
换成button按钮
<div class="loginBtn">
<button onclick="javascript:window.location.href='detailInfo/homepage.html'">登 录</button>
<a href="detailInfo/index0513.html">注 册</a>
</div>
另外,就你的需求,用<a>
就可以了。
有这么几种方式:
1、用服务器控件button,在button的后台代码中写:Response.Redirect("url");
2、用客户端button按钮,通过javascript:window.location.href="url";
3、用链接a标签,直接通过a的href属性指向url
如果你要做Form表单提交的话,要用<input type='submit' ........这个东西来做,地址写在<form action='.........'中,要是你想做单纯跳转,直接a标签就行,想要Button效果,就用样式表把a标签调一下就OK了
button的type类型改为button绑定onclick事件或者在按钮中直接写onclick="javascript:window.location.href='跳转地址'";
如果放到表单中要return false阻止表单提交。或者改type为button
<div class="loginBtn">
<button type="submit" onclick="window.location.href='detailInfo/homepage.html';return false;">登 录</button>
<a href="detailInfo/index0513.html">注 册</a>
</div>
在button的click事件里添加:
form2.show();
点击button跳转到新的页面有好几种方式,没必要纠结一种