mouse event oncontextmenu ocultar

HTML

<html>
<head>

</head>
<body  oncontextmenu="return false;">

<div id="box" style="background-color:gray; 	text-align:center; width:300px; height:300px;">
  In der gesamten grauen Box<br>gilt das Event<br>oncontextmenu
  <div id="msg" style="background-color:red; visibility:hidden;margin-top: 40px">
  hello world
  </div>
</div>

</body>
</html>

JavaScript

var box= document.getElementById('box');

box.oncontextmenu=function(){
if (document.getElementById("msg").style.visibility === "hidden")
{
document.getElementById("msg").style.visibility = "visible";
}else{
document.getElementById("msg").style.visibility = "hidden";
}
};