您的位置:首页 > 技术中心 > 前端框架 >

css怎么给按钮加上超链接

时间:2021-01-05 10:48

css给按钮加上超链接的方法:1、使用“window.location.href('url地址')”方法让本页转向新的页面;2、使用“window.open('url')”方法打开一个新的页面。

本教程操作环境:windows7系统、HTML5&&CSS3版本,Dell G3电脑。

相关推荐:《css视频教程》

html/css给按钮加上超链接

可以使用HTML onclick 事件属性

1、如果让本页转向新的页面则用:

<input type="button" onclick="window.location.href('url地址')">

<button onclick="javascript:window.location.href='url地址';">这是一个按钮</button>

2、如果需要打开一个新的页面进行转向,则用:

<input type="button" onclick="window.open('url')">

3、如果需要返回到上次打开的页面,则用:

<input type="button" onclick="window.history.back()">

以上就是css怎么给按钮加上超链接的详细内容,更多请关注www.gxlsystem.com其它相关文章!

本类排行

今日推荐

热门手游