how can i use onMouseOver on a <asp:TextBox> ?

Last post 06-28-2007 9:02 AM by zuperboy90. 8 replies.

Sort Posts:

  • how can i use onMouseOver on a <asp:TextBox> ?

    06-27-2007, 5:30 PM
    • Member
      615 point Member
    • zuperboy90
    • Member since 05-15-2007, 5:45 AM
    • Bucharest Romania
    • Posts 674

    hy,

    i have a problem...i don't know how to use onmouseover function on a <asp:textBox>...is that possible?

    i can't make the traditional <input> because i don't know to change all that stuffs from that "sign up wizzard" from the Web Developer...(it is using <asp:...> at all stuffs)

    i want to use onmouseover for something like that: onmouseover=" p1.className='red' "..can i use some triks for that <asp:...>?

    i really need to know, please help meSad

  • Re: how can i use onMouseOver on a <asp:TextBox> ?

    06-27-2007, 5:42 PM
    • All-Star
      32,526 point All-Star
    • augustwind
    • Member since 07-21-2002, 11:16 PM
    • Garland, TX
    • Posts 4,550
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    You could create what you need in the Javascript onmouseover function -

    then, add an attribute to the textbox, using that function when the page loads.
    Check out the different ways to do it here (from the Tips & Tricks section of ASPNEt101.com):
    http://www.aspnet101.com/aspnet101/tips.aspx?id=166

    David Wier
    MCP/ASPInsider
    ASPNet101.com - where to look first!
    Replace It! - the newest from August Wind - search/replace in multiple files
    Control Grouper - easily control properties for multiple controls with one control!
    Calendar Express - The Best HTML Calendar Generator on the web!
    (Please 'Mark as Answer' when it applies)
  • Re: how can i use onMouseOver on a <asp:TextBox> ?

    06-27-2007, 7:25 PM
    • All-Star
      23,606 point All-Star
    • azamsharp
    • Member since 06-11-2003, 9:36 AM
    • Houston,Texas
    • Posts 4,519
    • TrustedFriends-MVPs

     Dear Friend,

    Not sure about your needs but I think you are looking for onfocus. Onfocus will be fired when the user focuses on the TextBox. This means when the user clicks inside the TextBox the onfocus will be fired. Let me know if you need further assistance. 

    HighOnCoding
    Get high on ASP.NET articles, videos, podcasts and more!
  • Re: how can i use onMouseOver on a <asp:TextBox> ?

    06-27-2007, 7:55 PM
    • Participant
      992 point Participant
    • vicpal25
    • Member since 03-08-2006, 11:33 PM
    • Posts 407

    Like this my brotha: 

     

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
          txtBoxControl.Attributes.Add(" onMouseOver", "JavaScriptMethod();")
    
        End Sub
     On your Page Load Event just add the attribute to the text box control 
      
    Victor A. Palma
  • Re: how can i use onMouseOver on a <asp:TextBox> ?

    06-28-2007, 3:07 AM
    Answer

     <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript" language="javascript">
        function test()
        {    
            document.getElementById('<%=TextBox1.ClientID%>').style.backgroundColor = "red";
        }
        function test1()
        {    
            document.getElementById('<%=TextBox1.ClientID%>').style.backgroundColor = "white";
        }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <asp:TextBox ID="TextBox1" runat="server" onMouseOver = 'test()' onMouseOut = 'test1()'></asp:TextBox>
        </div>        
        </form>
    </body>
    </html>

    hope this helps./. 

    नमस्ते,
    [KaushaL] || BloG || MS MVP

    "I would love to change the world, but they won’t give me the source code"


    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
  • Re: how can i use onMouseOver on a <asp:TextBox> ?

    06-28-2007, 7:18 AM
    • Member
      615 point Member
    • zuperboy90
    • Member since 05-15-2007, 5:45 AM
    • Bucharest Romania
    • Posts 674

    thank you to all, with peolple like you i start belive i can really make a site...thanks

  • Re: how can i use onMouseOver on a <asp:TextBox> ?

    06-28-2007, 8:29 AM
    • Member
      615 point Member
    • zuperboy90
    • Member since 05-15-2007, 5:45 AM
    • Bucharest Romania
    • Posts 674

    how is writing corectly

    document.getElementById("<%=TextBox"+1+".ClientID%>").style.backgroundColor = "red"; ?

    it give an error that says ") expected"...i want to make a for and i don't know how to adapt that ("<%=...%>")

  • Re: how can i use onMouseOver on a <asp:TextBox> ?

    06-28-2007, 8:46 AM

    zuperboy90:

    document.getElementById("<%=TextBox"+1+".ClientID%>").style.backgroundColor = "red"; ?

    it give an error that says ") expected"...i want to make a for and i don't know how to adapt that ("<%=...%>")

     

    i am not getting exactly what you are trying to do.. can you elaborate in some more detail please ? 

    नमस्ते,
    [KaushaL] || BloG || MS MVP

    "I would love to change the world, but they won’t give me the source code"


    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
  • Re: how can i use onMouseOver on a <asp:TextBox> ?

    06-28-2007, 9:02 AM
    • Member
      615 point Member
    • zuperboy90
    • Member since 05-15-2007, 5:45 AM
    • Bucharest Romania
    • Posts 674

    yes...

    for(int a=1, a<=5, a++){

    document.getElementById("<%=TextBox"+a+".ClientID%>").style.backgroundColor="red";

    }

    something like that...hope helps...

Page 1 of 1 (9 items)