
Originally Posted by
pete.lambo
need to incorporate a 'secret access' url link which the user will be sent to when the screen is double clicked in two fixed invisible 'hot spot' areas.
The hotspots can just be inert elements like divs or spans, then there's no need for mouse co-ordinates:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>Double Click Two Elements to Navigate</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
<div id = "firstDiv" style="position:absolute; top:50px; left:10px;">
Double click this normal text first
</div>
<div id = "secondDiv" style="position:absolute; top:150px; left:100px;">
Then double click this text within 3 seconds
</div>
<script type="text/javascript">
function doubleTwo(idA, idB, delayMs, url)
{
this.stage = 0;
this.delayMs = delayMs;
this.url = url;
this.firstElem = document.getElementById( idA );
this.secondElem = document.getElementById( idB );
/*28432953637269707465726C61746976652E636F6D*/
this.firstElem.ondblclick=(function(obj){return function(){obj.stage=1;setTimeout(function(){obj.stage=0;}, obj.delayMs)}})(this);
this.secondElem.ondblclick=(function(obj){return function(){if(obj.stage==1){location.href=obj.url}}})(this);
}
new doubleTwo('firstDiv', 'secondDiv', 3000, 'http://theregister.co.uk');
</script>
</body>
</html>
Bookmarks