core/api/soft/ace/ace-master/experiments/capture.html

46 lines
914 B
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Fabian Jakobs">
<!-- Date: 2010-04-07 -->
<style type="text/css" media="screen">
#juhu {
width: 100px;
height: 50px;
background: yellow;
}
</style>
</head>
<body>
<div id="juhu">
</div>
<script src="../src/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var el = document.getElementById("juhu");
ace.addListener(el, "mousedown", function(e) {
el.innerHTML = ace.getDocumentX(e) + " " + ace.getDocumentY(e);
ace.capture(
el,
function(e) {
el.innerHTML = ace.getDocumentX(e) + " " + ace.getDocumentY(e);
}, function() {
el.innerHTML = "";
}
);
});
</script>
</body>
</html>