Click to See Complete Forum and Search --> : Simulate Shift+Enter keysPress


tadzio
02-24-2003, 03:45 PM
I want to do such thing:

if (window.event.keyCode==13) //enter pressed
{
/* I want instead of enter pass Shift + Enter event to
the window. I can’t find anywhere example on passing
two keys pressed at the same time :(
*/
}

thnx for all help

tadzio
02-24-2003, 05:53 PM
I have no problem in detecting the event.
Problem is in simulating it.
I want to send event that simulates both key Shift and Enter
pressed at the same time...
I know it is taff but it must be possible...I hope ;)

tadzio
02-25-2003, 12:50 AM
OK. Why can't I create additional, new event. One will simulate Enter press second Shift. Can I have two events running at the same time?

Thnx for your patience... :)

tadzio
02-25-2003, 09:08 AM
never mind... I don't need philosopher I need programmer with some skills

Nicodemas
02-26-2003, 02:44 AM
:eek:

tadzio
02-26-2003, 09:06 AM
WOW DAVE!!!
GOOD FOR YOU!!!

TageShadow
02-26-2003, 12:14 PM
I'm new to these message boards, so forgive me if this code doesn't show up correctly, but put this code in the head and it should work with internet explorer at least. Don't have netscape to test it in. I have attached a working zipped .html file. Unzip it. Hope it helps =)

<script language="JavaScript">
<!--
function NNShiftEnter(thisOne)
{
if (thisOne.modifiers & Event.SHIFT_MASK)
{
if (thisOne.which == 13)
{alert('That\'s the enter key with shift held down in Netscape')};
}
}

function IEShiftEnter()
{
if (window.event.shiftKey)
{
if (window.event.keyCode == 13)
{alert('That\'s the enter key with shift held down in Internet Explorer')};
}
}

if (navigator.appName == 'Netscape') {
window.captureEvents(Event.KEYPRESS);
window.onKeyPress = NNShiftEnter;
}

document.onkeypress = IEShiftEnter;
//-->
</script>

tadzio
02-26-2003, 03:08 PM
OK. It is not what I ment...
I know how to detect it:

if (event.shiftKey && event.keyCode==13)
{
alert("SHIFT + Enter");
}

but I want to send such event to the window...

but THNX anyway :)