Re: Getting value from asp:label into javascript input value
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Getting value from asp:label into javascript input value

From: Dag Sunde <me@dagsunde.com>
Date: Fri Aug 05 2005 - 21:16:53 CEST

"Dwizz" <Dwizz20@yahoo.co.uk> wrote in message
news:1123245455.237131.80770@f14g2000cwb.googlegroups.com...
> Thanks for the quick responce Dag,
>
> so just to clarify,
>
> My ASP:Label is as follows
> <asp:Label id="Label2" font-names="Arial" font-size="X-Small"
> runat="server">Label</asp:Label>
>
> my Javascript input should be as follows;
> <script>
> var lbl = document.getElementById(Label2);
> alert(lbl.value);
> </script>
>
> <input id="Label2" readonly="readonly" type="text" value=""
> name="unitprice[]" />

Almost... You must quote the id:
var lbl = document.getElementById("Label2");

But maybe I'm wrong here... asp:xxx is dotnet, isn't it?

I thought you asked how to get the content of a html <label> tag.
In the sample above, you're refering to <asp:label>, and I'll have to admit
I don't have a clue what that is.

Anothewr thing is that an id attribute must be unique within the page
(You repeat it in the <input> tag...

-- 
Dag.
Received on Mon Oct 24 02:13:52 2005