Whats wrong with my mouseup code?
http://stackoverflow.com/q/10069918/154877
by Marcel
HTML
<script src="https://raw.github.com/wiggin/jQuery-Easy-Confirm-Dialog-plugin/master/jquery.easy-confirm-dialog.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/blitzer/jquery-ui.css">
<div id="wrap">
<header>
<h1>Whats wrong with my mouseup code?</h1>
</header>
<section>
<button onmouseup="cclick()">Click with your mouse</button>
</section>
<footer>This is a code example for the Stack Overflow question <br><a href="http://stackoverflow.com/q/10069918/154877">"Whats wrong with my mouseup code?"</a></footer>
</div>
CSS
body { color:#222; background:#ddd; font:13px/1.4 'segoe ui', sans-serif; }
h1, h2 { margin:0 0 .25em; font:700 2em/1.2 'myriad pro', sans-serif; } h2 { color:#999; margin: 1em 0 .25em; font-size:1.6em; }
a { color:#06c; transition:.2s linear; -webkit-transition:.2s linear; } a:hover { color:#39f; }
p { margin:1em 0; } footer { color:#999; margin:3em 0 0; text-align:center; } footer a { color:#333; }
li { margin:0 0 .5em; }
#wrap { width:80%; margin:2em auto; background:#fff; }
header, footer, section { padding:1em 2em; }
header { color:#fff; background:#333; }
footer { color:#666; background:#bbb; }
JavaScript
function cclick(e) {
var rightclick;
if (!e) var e = window.event;
if (e.which) rightclick = (e.which == 3);
else if (e.button) rightclick = (e.button == 2);
alert('Rightclick: ' + rightclick); // true or false
}