Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Help menu(like IE help menu(pressing F1)

  1. #1
    Join Date
    Mar 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help menu(like IE help menu(pressing F1)

    Dear friends

    I am writing help menu(example when we are useing internet explorer at that time we suppose to press F1,at thime one help menu appear, that type of the help menu I am writing(Javascript)any one having the script pl let me know

    Thanks inadvance
    Rgds
    GR(henfin@gmail.com)
    Last edited by thetestingsite; 04-11-2007 at 12:54 AM. Reason: Editted for formatting

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Mar 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Dear friend(thetestingsite)

    Thanks for your reply. your examples are something different but totally new. please open your internet explorer than just you press F1, now your doubt will be clear.

    once again thanks for you, real efforts taken by you
    Rgds
    GR
    India

  4. #4
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    I don't think that's possible.

    Just a simple "Help" link would do.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  5. #5
    Join Date
    Mar 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Help (javascript)menu F1 coding

    Dear Mr Peter

    Thanks for your reply. Do u have any javascript based coding which is related to my requirments?

    Thanks once again
    Rgds

    GR(henfin@gmail.com)
    India

  6. #6
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Nope. [F1] is reserved to the system.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  7. #7
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Try the following code (This works only in IE not in Firefox)

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body onhelp="javascript: alert('hello');return false;">
    </body>
    </html>
    This proves that you can trap F1 key.

  8. #8
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Here is a solution based on Yahoo User Interface JavaScript framework which illustrates the trapping of F1 key both in IE and Firefox. Tested in IE 7 and Firefox 2.0.0.3

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.2.0/build/yahoo/yahoo-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.2.0/build/event/event-min.js"></script>
    <script type="text/javascript">
    
    document.focus; //Focusing on the document is important as the F1 key trapped is based on the document object.
    
    function isexplorer(){
      if(navigator.appName.indexOf('Microsoft')!=-1)
    	   return true;
      else
    	   return false;
    }
    YAHOO.util.Event.addListener(document, "keydown", processKeyDown); //This listener listens for keydown event.
    
    document.onhelp = new Function("return false;"); // To disable default help in IE
    
    function processKeyDown(evnt) {
       if ( evnt == null )
           evnt = event;
       if ( evnt.keyCode == 112 ) //F1
       {
           help(); // Insert the help function calling or script statement here
           
    	   if(isexplorer()== false)
    	   {
    	   		evnt.preventDefault();  // disable default help in Firefox
    	   	}
           return false;
       }
    }
    
    function help()
    {
    	//Handles the help part
    	alert('This is the help function');
    	
    }			
    </script>
    </head >
    <body>
    <h2 style="color:blue;">F1 Key Press Trapping Demo</h2>
    </body>
    </html>
    In the above code the required JS files is being accessed directly from Yahoo's UI server.

  9. #9
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    But that would be a bit stupid to do right?

    What if someone wants to access the browser help file?
    What about if someone has JS disabled?
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  10. #10
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    But that would be a bit stupid to do right?
    I personally feel it is better to not override system settings but it is my opinion.

    What if someone wants to access the browser help file?
    They can/have to access the browser help file through the Help menu in the browser window.

    What about if someone has JS disabled?
    This applies to all the scripts based on the JavaScript. If the user disables the JS then they won't be able to run their JavaScript in their browser. I still feel that the usage of JavaScript is somewhat ambiguous as the developer don't know whether the script is going to be executed in the client end successfully or not as it is based on client's browser settings.

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
  •