Using label in javascript

Discussion in 'ASP .Net' started by Vik, Apr 1, 2004.

  1. Vik

    Vik Guest

    The following code returns an error message (null object):

    document.forms[0]['Label1'].value='';

    Is it possible to use an ASP or HTML label in JavaScript?

    Thank you.
     
    Vik, Apr 1, 2004
    #1
    1. Advertising

  2. Vik

    bruce barker Guest

    labels are not form elements, but rather are html elements, you have to use
    the html dom to access them. try:

    document.getElementById('Lable1').innerHTML = '';

    -- bruce (sqlwork.com)


    "Vik" <viktorum@==hotmail.com==> wrote in message
    news:...
    > The following code returns an error message (null object):
    >
    > document.forms[0]['Label1'].value='';
    >
    > Is it possible to use an ASP or HTML label in JavaScript?
    >
    > Thank you.
    >
    >
    >
    >
     
    bruce barker, Apr 1, 2004
    #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. Shapper
    Replies:
    2
    Views:
    752
    Scott Mitchell [MVP]
    May 7, 2005
  2. Josef K.

    <label><div></div></label> allowed?

    Josef K., May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    13,552
    Josef K.
    May 22, 2005
  3. Praveen
    Replies:
    1
    Views:
    1,014
    Rob Williscroft
    Nov 5, 2006
  4. CSharpner
    Replies:
    0
    Views:
    1,092
    CSharpner
    Apr 9, 2007
  5. Knut Krueger
    Replies:
    8
    Views:
    293
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page