IT俱乐部 HTML html页面点击按钮实现页面跳转功能

html页面点击按钮实现页面跳转功能

html页面点击按钮实现页面跳转

方法1、在button标签外嵌套一个a标签,利用超链接进行跳转;

方法2、在button标签中添加οnclick=”window.location.href=‘页面url’”代码,使用onclick事件进行跳转。

html页面自动跳转方法

1.使用meta元素


http-equiv=“refresh” 是刷新页面,5秒后执行刷新操作,url是跳转的目的页面地址。


这行代码的意思是只刷新,不跳转。

2.使用script代码

立即跳转到hello.html页面。

    window.location.href = 'hello.html';

或者

    location.replace("http://www.baidu.com/");

5秒后跳转到hello.html页面。

    setTimeout("window.location.href = 'hello.html'", 5000);

3.判断是否手机端

var wapurl = window.location.pathname; 
if
    (/Android|webOS|iPhone|iPod|BlackBerry|Windows CE|Windows Phone/i.test(navigator.userAgent))
{if
    (window.location.href.toLowerCase().indexOf("?pc")<0)
{try
    {window.location.href="/wap"+wapurl}
    catch(e){}}
    }

到此这篇关于html页面点击按钮实现页面跳转的文章就介绍到这了,更多相关html点击按钮跳转页面内容请搜索IT俱乐部以前的文章或继续浏览下面的相关文章,希望大家以后多多支持IT俱乐部!

本文收集自网络,不代表IT俱乐部立场,转载请注明出处。https://www.2it.club/navsub/html/9340.html
上一篇
下一篇
联系我们

联系我们

在线咨询: QQ交谈

邮箱: 1120393934@qq.com

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部