Please Help With Java Script and ASPX

Discussion in 'ASP .Net' started by Charles A. Lackman, Jul 2, 2003.

  1. How do I retrieve a value from an ASP.NET Textbox in Java Script.

    The following code returns Null, What am I doing wrong?

    var AName = document.GetElementById("txtName.Value")

    Changing "Value" to "Text" also returns Null, Also, if I remove "Value"
    [object] is returned.

    txtName is a ASPX textbox that the visitor places their name into.

    Thanks
    Chuck
    Charles A. Lackman, Jul 2, 2003
    #1
    1. Advertising

  2. Charles A. Lackman

    Marina Guest

    Try document.getElementById("txtName").value

    Javascript is case sensitive. Also, txtName.Value isn't a name of an object.
    txtName is the object - and you want to get the value of it.

    "Charles A. Lackman" <> wrote in message
    news:...
    > How do I retrieve a value from an ASP.NET Textbox in Java Script.
    >
    > The following code returns Null, What am I doing wrong?
    >
    > var AName = document.GetElementById("txtName.Value")
    >
    > Changing "Value" to "Text" also returns Null, Also, if I remove "Value"
    > [object] is returned.
    >
    > txtName is a ASPX textbox that the visitor places their name into.
    >
    > Thanks
    > Chuck
    >
    >
    >
    Marina, Jul 2, 2003
    #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. John M
    Replies:
    1
    Views:
    1,104
    Kumar Reddi
    May 29, 2005
  2. Replies:
    4
    Views:
    490
    Chris Uppal
    May 5, 2005
  3. KK
    Replies:
    2
    Views:
    515
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,716
    Mike Hewson
    Jan 7, 2005
  5. Mike
    Replies:
    2
    Views:
    663
Loading...

Share This Page