11智能在线
新记
怎么用JavaScript实现按一个按钮然后跳转页面
如题所述
举报该文章
相关建议 推荐于2017-09-25
使用如下javascript代码可以实现页面跳转:
window.location.href = url; // 跳转到url页面
location.href = url; // 这样也行
实例演示如下:
1、关键代码
<input type='button' value='前往百度' onclick="location.href = '
https://www.baidu.com/'"/>
2、效果演示
温馨提示:内容为网友见解,仅供参考
当前网址:
https://11.t2y.org/zz/v8s87vf.html
其他看法
第1个回答 推荐于2017-09-28
或者<input name="xx" value="xxx" type="button" onclick="windows.location.href='路径'">
如果有父窗体 想让整个页面都跳转
<input name="xx" value="xxx" type="button" onclick="top.location.href='路径'">本回答被提问者采纳
第2个回答 2006-04-21
<input name="xx" value="xxx" type="button" onclick="this.location.href='路径'">
相似回答
大家正在搜
相关问题
JavaScript怎么利用按钮实现页面跳转代码
各位大神好,如何根据页面元素的ID点击按钮跳转到指定的页面,...
用js实现两个按钮效果,上一页 下一页,点上一页按钮页面跳转...
javascript中实现按不同按钮跳转到不同页面
javascript怎么跳转页面
使用JS控制一个按钮跳到不同的页面
怎么利用js代码选中其中一个radio单选按钮,然后跳到指定...
我有两个web网页A,B A有一个按钮,点击它,页面从A跳转...