how to clear the value of the control

Discussion in 'C#' started by arunpulikkan, May 7, 2007.

  1. #1
    Hi ,Guys

    Im new to ASP programming,in my application i have a textarea control and in the load time the value is set to this conmtrol as like

    <input type="text" name="displayname" maxlength="200"size="40" value="<%=rsInput("displayname")%>">

    and i have a button when i click on that button i need to clear the value inside the text control.

    i used document.fomname.controlname.value="" its not clearing because of i set thevalue as value="<%=rsInput("displayname")%>".when i use

    document.fomname.controlname.focus() the focus is comming.so how can i clear the value inside this text control


    Thanks,
    Arun
     
    arunpulikkan, May 7, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Give it an ID of txtControl

    document.getElementById("txtControl").value = "";

    call this right before the .focus()
     
    ccoonen, May 8, 2007 IP