xxxxxxxxxx
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>基础教程(div.cn)</title>
</head>
<body>
<div contextmenu="test"></div>
<menu type="context" id="test">
<menuitem label="alert" onclick="alert('the alert label has been clicked')" />
</menu>
<script>
document.getElementById("test").addEventListener("show", function(e){
alert("the context menu will be displayed");
}, false);
</script>
</body>
</html>