button跳转

好多人比较熟悉的就是a 链接。如: <a href="xx.html"></a>。这样的确比较方便。就如我来说,
根本就不会直接写 button 然后方法。but 当我换了一份工作之后,被指出button里面套a,
是不专业 的写法。所以此篇文章主要是介绍button如何跳转。

1.使用a标签**
a标签的超链接可以直接嵌套一个button
	<a href="xx.html">
            <button>点击跳转</button>
        </a>
2.使用onclick属性**
           <button onclick="window.location.href='xx.html'">
            点击跳转
           </button>
3. window.open**
	 <button onclick="window.open='xx.html'">
            点击跳转
           </button>
4.js方法**
     	<button onclick="Jump()">
	    按钮
	</button>
        <script>
		    function Jump(){
		        window.location.href='xx.html'
		    }
	</script>
5.jq方法**
	<button id=‘jump’>
	    按钮
	</button>
	<script>
		  $(document).ready(function(){
		  $('jump').click(function(e){
		  window.open('xx.html')
		})
	})
	</script>

        button 跳转有多种方法,正如‘一千个人眼里有一千个哈姆雷特’,不要拘泥于别人的印象中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值