这并不是说我要防止“查看源代码”或类似的愚蠢行为,而是要为某些元素制作一些自定义上下文菜单。
编辑:答案的答复:我已经尝试过:
<a id="moo" href=''> </a>
<script type="text/javascript">
var moo = document.getElementById('moo');
function handler(event) {
event = event || window.event;
if (event.stopPropagation)
event.stopPropagation();
event.cancelBubble = true;
return false;
}
moo.innerHTML = 'right-click here';
moo.onclick = handler;
moo.onmousedown = handler;
moo.onmouseup = handler;
</script>
斯蒂芬大帝
慕慕森
Cats萌萌
相关分类