Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Netscape

  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Netscape

    Maybe some one can show me how to modify this script to work with both Netscape and Explorer. It no works only with explorer "disables the enter key"

    <SCRIPT LANGUAGE="JavaScript">
    function modifKey(e)
    {
    var modif='';
    if (event.altKey)
    {
    modif+='[ Alt ] ';
    }
    if (event.ctrlKey)
    {
    modif+='[ Ctrl ] ';
    }
    if (event.shiftKey)
    {
    modif+='[ Shift ] ';
    }
    getKey(e,modif);
    }
    function getKey(e,modif)
    {
    if (e.keyCode)
    {
    keycode=e.keyCode;
    }
    else
    {
    keycode=e.which;
    }
    char=String.fromCharCode(keycode);
    xCode=char.charCodeAt(0);
    if (xCode == 13) //Enter key is pressed!!
    {
    window.event.keyCode = 0;
    }
    else
    {
    return true;
    }
    }


    <body MS_POSITIONING="GridLayout" onkeypress=' return modifKey(event);'>

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    I don't use Netscape any more but this may do the trick:

    <SCRIPT LANGUAGE="JavaScript">
    if (document.layers) document.captureEvents(Event.KEYPRESS);
    function modifKey(e)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •