changing the lable on a text box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thelouvre
    New Member
    • Feb 2010
    • 12

    changing the lable on a text box

    Given the following code:
    <FORM NAME="MyCircleF orm">
    <TABLE BORDER CELLPADDING=3>

    <tr>
    <td >
    <input name="SimpleSea rches" type="radio" value="Circle" onclick="Enable TableElements(' Circle')"/> Circle</td>
    <td >
    <input type="radio" name="SimpleSea rches" value="Square" onclick="Enable TableElements(' Square')"/> Square </td>


    </tr>
    <TR>
    <TD><NOBR>radiu s: <INPUT NAME="Circle_ra dius" SIZE=4></NOBR></TD>
    <TD><INPUT TYPE=BUTTON OnClick="Circle _calc_ii(this.f orm);" VALUE="calculat e"></TD>
    <TD ALIGN=RIGHT BGCOLOR="#AACCF F">
    <NOBR>circumfer ence: <INPUT NAME="Circle_ci rcumference" SIZE=9></NOBR><BR>
    <NOBR>area: <INPUT NAME="Circle_ar ea" SIZE=9></NOBR></TD>
    </TR>

    </TABLE>
    </FORM>

    Say you want the input box labeled radius to read radius if circle button is pushed but you want the input box to be labeled side if square radio button is pressed. What is the attribute you are changing here to go between radius and side labels or circumference and perimeter labels that depend on which radio button is pressed?
    Thanks.
  • thelouvre
    New Member
    • Feb 2010
    • 12

    #2
    use innertext

    var elementFirst = document.getEle mentById("First ");
    elementFirst.in nerText = "Whatever the new text is!";

    I think this works for IE only.

    Comment

    Working...