Internet Explorer F1 keypress displays your own help RRS feed

  • Question

  • User-1513591455 posted

     I have an application that has its own help system.  Clicking a "help" link on the page or pressing the F1 key provdes a newly opened help window with the correct page help.  It does this by referencing the Page.ID value passed in a querystring.

    You could go furthe and add a reference to a control on the page too


    There is some javascript required to intercept the existing help event and redirect to your own

    <script type="text/javascript" language="Javascript">

    //Redirect help requests to our own function

    document.onhlep = MyHelp;

    window.onhelp = MyHelp;


    // intercept the web browser help request (F1 pressed) and redirect to our own help

    function MyHelp() {

    // I already have a help link in the page with an image in.  Code behind sets the Page.ID to give the relevant querystring.  Simulate a user clicking the hyperlink

    $get('<%= hlnkHelp.ClientID %>').click();

    // return false to cancel browser opening Windows F1 Help when we have finished

    return false;




    Elsewhere in the page...


    <asp:HyperLink ID="hlnkHelp" runat="server" Target="Help" NavigateUrl="~/Help.aspx" ToolTip="View Help for this Page" ImageUrl="~/Images/Help.png"></asp:HyperLink>



    Elsewhere in the code behind page load

    if (!IsPostBack)

    // set the help querystring - although this value could also be set in the ASPX page too

    hlnkHelp.NavigateUrl = "~/Help.aspx?WebPageId=" + Page.ID;


    Friday, January 16, 2009 8:40 AM

All replies

  • User289008742 posted
    Hi may be you can give the java script function in the Body onkeydown event.
    and check the key ascii value if it is equal to f1 then you can redirect to your help page..
    function myhelp()
    var code = event.keycode; // First get the F1 key code. and then remove this statement after you get the key code.
    if (event.keyCode == 'Key Code of f1')
    Redirect to your page.
    Hope this helps :)
    Friday, January 16, 2009 11:53 AM
  • User-1513591455 posted

    The keycode for F1 is 112, but you do not need it. Adding the onhelp event as in my version negates the need to check keycodes - any method the user utilises to raise a help request is captured

    Friday, January 16, 2009 12:24 PM
  • User-1764894953 posted

    Can u please give me how to do in asp.net.  

    Wednesday, June 9, 2010 12:08 PM