Button的onClick跳转到其他页面

本文介绍了如何使用HTML按钮实现页面间的跳转链接,包括内部页面链接及外部网站链接的实现方式,并提供了具体的代码实例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址:http://www.plus2net.com/html_tutorial/button-linking.php

Linking pages using buttons

Hyper links are used to link different pages within a site and outside a site to each other. Same thing can be achieved by using a button. We can use a button to link different pages. We will connect the url of the new page to the onclick event of the button. We can do this by using a form and a submit button but there is no point in using a form for a hyper linking of pages. So here are some examples of using buttons to link different pages.

<input type=button onClick="parent.location='index.html'" value='click here'>

Another way of linking button

<input type=button onClick="location.href='index.html'" value='click here'>

<input type=button onClick="parent.location='http://www.plus2net.com/'" value='click here to visit home page'>

Some time from SEO angle linking using a button is not a good idea as we loose the anchored text advantage of hyper linking.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值