how to access labels on a web form

Discussion in 'JavaScript' started by kiran1785, Apr 13, 2007.

  1. #1
    Hi,

    can someone plzz tell me which javascript function(s) can be used to access labels on a web form??

    Thanks
    Kiran
     
    kiran1785, Apr 13, 2007 IP
  2. mjamesb

    mjamesb Member

    Messages:
    88
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    48
    #2
    You need to provide a bit more information and some sample code. In general the only way to access a specific element on the page that is not an "input" type of element inside a form is to put an id on the element. If when you say label you actually mean a label element you need to put an id on it.

    <label id="label1">Text...</label>

    <script language="javascript">
    var lbl = document.getElementById("label1");
    lbl.innerHTML = 'new text';
    </script>
     
    mjamesb, Apr 13, 2007 IP