JavaScript中的目标元素

JavaScript中的目标元素,javascript,html,css,popup,Javascript,Html,Css,Popup,我在这里使用html5/css3模式窗口 ,您可以通过单击链接将其关闭 <a href="#close">X</a> 但是我怎样才能让它像这样工作呢 <div onclick="someFunction"> content </div> 内容 谢谢。试试这个 <div onclick="someFunction('close')">content</div> function someFunction(acti

我在这里使用html5/css3模式窗口 ,您可以通过单击链接将其关闭

<a href="#close">X</a>

但是我怎样才能让它像这样工作呢

<div onclick="someFunction">
content
</div>

内容
谢谢。

试试这个

<div onclick="someFunction('close')">content</div>

function someFunction(action){
  window.location.hash=action;
}
内容
函数someFunction(action){
window.location.hash=action;
}