简体   繁体   English

div 标签目标属性

[英]Div tag target attribute

I would like to add a target attribute to a div tag (see code below) so that the page "index.html" opens in the same page ie target_self我想将目标属性添加到 div 标记(请参见下面的代码),以便页面“index.html”在同一页面中打开,即 target_self

  <div id="home" style="cursor:pointer;
                 "href="javascript:void(0)" 
                 onclick="window.open('index.html')"></div>

You should change from window.open to window.location.href =您应该从window.open更改为window.location.href =

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM