problem with changing text of label with javascript

D

Dan

Hi,

i want to change the value of a textbox and the text of a label with
javascript.
I didi this:
it works for the textbox, but not for the label (i tried both with 'text'
and with 'value').
No error message.
Why does it not work for the label?
Thanks
Dan


<div>
<input id="Button1" type="button" value="button"
onclick="myfunction()" />
<asp:TextBox ID="Text1" runat="server" Text="textbox"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>

<script type="text/javascript">
function myfunction()
{
document.getElementById("Text1").value="ok"
document.getElementById("Label1").value="ok"
// i also tried with: document.getElementById("Label1").text="ok"
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top