获取href连接并跳转

摘要:
获取href连接:˂!

获取href连接:

<!DOCTYPE html>  
<html>  
<head>  
<script src="http://t.zoukankan.com/jquery/jquery-1.11.1.min.js"></script>  
<script>  
$(document).ready(function(){  
  $("button").click(function(){  
    alert($("#w3s").attr("href"));  
  });  
});  
</script>  
</head>  
  
<body>  
<p><a href="http://www.w3school.com.cn" id="w3s">W3School.com.cn</a></p>  
<button>显示 href 值</button>  
</body>  
  
</html>  

跳转:

1.在原来的窗体中直接跳转用  
  
window.location.href="http://t.zoukankan.com/你所要跳转的页面";  
  
2、在新窗体中打开页面用:  
  
window.open('你所要跳转的页面');  
  
window.history.back(-1);返回上一页  

  

免责声明:文章转载自《获取href连接并跳转》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇关于H5在微信获取授权怎么让 Lua 5.3.4 支持中文变量名和中文函数名下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

url、 src 和href 标签的区别

url 统一资源定位符  标准格式   协议类型:[//服务器地址[:端口号]][/资源层级UNIX文件路径]文件名?查询 url语法规则   scheme://host.domain:port/path/filename   https://www.baidu.com/daily/view?id=163664 scheme  定义因特网服务的类型,常见的...

让超链接点击后不跳转,可以用href = "https://tool.4xseo.com/article/267833.html",但是这个#就会锚点到页面最上边 点击链接后不跳转可以设置成

让超链接点击后不跳转,可以用href = "https://tool.4xseo.com/article/267833.html",但是这个#就会锚点到页面最上边     点击链接后不跳转可以设置成     1.<a href="javascript:void(0);" >javascript:void(0);</a>     2....

href="https://tool.4xseo.com/article/243199.html" 链接到当前页面

<a href="https://tool.4xseo.com/article/243199.html" onclick="window.close()">关闭</a>将href="https://tool.4xseo.com/article/243199.html"是指联接到当前页面,其实是无意义的,页面也不会刷新,关键是后面的o...