加德满都到巴德岗汽车:怎么用JavaScript实现按一个按钮然后跳转页面
来源:百度文库 编辑:神马品牌网 时间:2024/05/14 08:24:09
使用如下javascript代码可以实现页面跳转:
window.location.href = url; // 跳转到url页面
location.href = url; // 这样也行
实例演示如下:
1、关键代码
<input type='button' value='前往百度' onclick="location.href = 'https://www.baidu.com/'"/>
2、效果演示
或者<input name="xx" value="xxx" type="button" onclick="windows.location.href='路径'">
如果有父窗体 想让整个页面都跳转
<input name="xx" value="xxx" type="button" onclick="top.location.href='路径'">
<input name="xx" value="xxx" type="button" onclick="this.location.href='路径'">