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"
}
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"
}