Results 1 to 2 of 2

Thread: Shift Control Value

  1. #1
    Join Date
    Apr 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Shift Control Value

    hi ,

    i have a button.in this default value is present.i need to store two values in that.i.e if i press shift key the another value is taken.how to set that using script. for example if press the button in normal mode it will display 'a' if press shift+ button it take value as 'A'. how this can achieve using script.
    WHILE PRESSING THS BUTTON WITH SHIFT COMBINATION THE VALUE ALSO DISPLAYED IN bUTTON ALSO. in ' jscheuer1 'ANSWER THE BUTTON DISPLAY VALUE IS NOT CHANGED.SO HELP THIS TOO.
    THANKS.
    Last edited by cute; 05-12-2007 at 08:08 AM. Reason: I NEED MORE ON THAT

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Like a keyboard key? Try this out:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    function isShifted(e){
    var e=e? e : window.event;
    if(e.keyCode==16)
    isShifted.yes=e.type=='keydown'?1:0;
    }
    document.onkeyup=document.onkeydown=isShifted;
    
    </script>
    </head>
    <body>
    <div><input type="text" id="targ"><br>
    <input type="button" value="A" onclick="document.getElementById('targ').value+=isShifted.yes? this.value : this.value.toLowerCase();"></div>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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