2012-11-08 17:11:43 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<title>CasperJS test click</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a id="test1" href="javascript:results.test1 = true;">test1</a>
|
|
|
|
<a id="test2" href="#" onclick="results.test2 = true;">test2</a>
|
|
|
|
<a id="test3" href="page1.html" onclick="results.test3 = true; return false">test3</a>
|
|
|
|
<a id="test4" href="http://www.google.com/">test4</a>
|
|
|
|
<script>
|
|
|
|
(function(window) {
|
|
|
|
window.results = {
|
|
|
|
test1: false,
|
|
|
|
test2: false,
|
|
|
|
test3: false,
|
|
|
|
test4: false,
|
2013-03-05 17:10:02 +01:00
|
|
|
testdown: [],
|
|
|
|
testup: [],
|
|
|
|
testmove: [],
|
|
|
|
testclick: [],
|
|
|
|
testdoubleclick: []
|
2012-11-08 17:11:43 +01:00
|
|
|
};
|
|
|
|
document.querySelector('#test4').onclick = function(event) {
|
|
|
|
results.test4 = true;
|
|
|
|
event.preventDefault();
|
|
|
|
};
|
|
|
|
window.onmousedown = function(event) {
|
|
|
|
results.testdown = [event.x, event.y];
|
|
|
|
};
|
|
|
|
window.onmouseup = function(event) {
|
|
|
|
results.testup = [event.x, event.y];
|
|
|
|
};
|
|
|
|
window.onmousemove = function(event) {
|
|
|
|
results.testmove = [event.x, event.y];
|
|
|
|
};
|
2013-03-05 17:10:02 +01:00
|
|
|
window.ondblclick = function(event) {
|
|
|
|
results.testdoubleclick = [event.x, event.y];
|
|
|
|
};
|
2012-11-08 17:11:43 +01:00
|
|
|
})(window);
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|