PS: 偶然间百度到的,不用使用表单中的submit去跳转,直接在JS函数中写一行代码,即可实现跳转到指定页面. 但不能传递数据!!!
例如: 在租车系统中,我想在前台的用户注册和后台的更新用户成功后返回到指定页面,即可以在JS中写一个function back()函数,在函数中写如下的任意一种,即可实现跳转到指定页面
第一种:(跳转到b.html)
window.location.href="b.html";
第二种:(返回上一页面)
window.history.back(-1);
第三种:
window.navigate("b.html");
第四种:
self.location=’b.html’;
第五种:
top.location=’b.html’;
前进:history.forward();或者history.go(1); 后退: history.back (); 或者history.go(-1); 实现点击按钮弹出窗口的代码:
document.getElementById( 'button' ).onclick = function(){
window.open ('page.html');
}
其中,button 是按钮的 id,page.html 是要弹出的窗口页面。