How would I... ?
Posted: Wed May 18, 2005 3:05 pm
Just curious if anyone knows how I would make text print out when I hold a spacific key and remove it when I release.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<script language="e;Javascript"e;>
<!--
function toggleDiv(id,flagit) {
if (flagit=="e;1"e;)
{
if (document.layers) document.layersї''+id+''].visibility = "e;show"e;
else if (document.all) document.allї''+id+''].style.visibility = "e;visible"e;
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "e;visible"e;
}
if (flagit=="e;0"e;)
{
if (document.layers) document.layersї''+id+''].visibility = "e;hide"e;
else if (document.all) document.allї''+id+''].style.visibility = "e;hidden"e;
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "e;hidden"e;
}
}
function ViewData(user,ValueShow)
{
if(user.style.visibility==ValueShow)return true
var mousex = window.event.x; // mouse location capture event
var mousey = window.event.y; // mouse location capture event
user.style.visibility = ValueShow; // show or hide respective Example
user.style.left = mousex - 50; // place popup at the mouse X (left) location
user.style.top = mousey; // place popup at the mouse Y (top) location
}
//-->
</script>
<style>
#example1 {
position:absolute;
width:150px;
height:100px;
color:blue;
text-align:center;
visibility:hidden;
z-index:10;
}
</style>
</head>
<body onKeyDown="e;ViewData(example1,'visible')"e; onKeyUp="e;ViewData(example1,'hidden')"e;>
<div id="e;example1"e;>
This is the menu
</div>
</body>Code: Select all
function checkEvt(evt){
if(evt.keyCode == 13 && evt.ctrlKey){
//do stuff
}
}
<span onClick="e;checkEvt(event)"e;>click me</span>