html给div加超链接实现点击div跳转的方法

1.通过window.open函数
<div onclick="window.open(*http://www.baidu.com*)">在新窗口跳转至百度</div>
<div onclick="window.open(*http://www.baidu.com*,*_self*)">在当前窗口跳转至百度</div>
2.通过window.location.href函数
<div onclick="window.location.href= *http://www.baidu.com*;return false">在当前窗口跳转至百度</div>

原文地址:https://www.cnblogs.com/ghfjj/p/6689902.html