JScript / JavaScript Help

Discussion in 'ASP .Net' started by Roshawn Dawson, Mar 18, 2005.

  1. Hi,

    Could someone tell how to force a mouse event using either jscript or
    javascript? I simply want to allow users to scroll the page after
    postbacks using the scroll button on either a mouse or the keyboard
    without them having to click the page first.

    Thx,
    Roshawn
     
    Roshawn Dawson, Mar 18, 2005
    #1
    1. Advertising

  2. Hi Roshawn,

    The simplest way is to make sure that a control on the page has the focus
    after the page is loaded. In the sample below, I give the textbox a tabindex
    and in the codebehind, I emit the Javascript to cause the textbox to have
    the focus.

    Let us know if this helps?

    Ken
    Microsoft MVP [ASP.NET]
    Toronto

    <form id="Form1" method="post" runat="server">
    <p>
    <asp:textbox TabIndex="0" id="TextBox1"
    runat="server"></asp:textbox></p>
    <p>
    <asp:button id="Button1" runat="server"
    Text="Button"></asp:button></p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>
    <asp:hyperlink id="HyperLink1"
    runat="server">HyperLink</asp:hyperlink></p>
    </form>

    Private Sub Page_Load _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    Page.RegisterStartupScript("startup", _
    "<script>TextBox1.focus();</script>")
    End Sub

    "Roshawn Dawson" <> wrote in message
    news:...
    > Hi,
    >
    > Could someone tell how to force a mouse event using either jscript or
    > javascript? I simply want to allow users to scroll the page after
    > postbacks using the scroll button on either a mouse or the keyboard
    > without them having to click the page first.
    >
    > Thx,
    > Roshawn
     
    Ken Cox [Microsoft MVP], Mar 18, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Maz
    Replies:
    4
    Views:
    1,316
    Jon Maz
    Sep 9, 2004
  2. =?Utf-8?B?UkZTNjY2?=
    Replies:
    7
    Views:
    808
    Patrice
    Oct 28, 2005
  3. Maxwell2006
    Replies:
    5
    Views:
    2,436
    Steven Cheng[MSFT]
    Mar 7, 2006
  4. John Bentley
    Replies:
    14
    Views:
    386
    Jim Ley
    Feb 5, 2004
  5. VK
    Replies:
    4
    Views:
    377
    Thomas 'PointedEars' Lahn
    Jan 12, 2006
Loading...

Share This Page