PDA

Click to See Complete Forum and Search --> : asp:Label and Javascript


OneSource
Apr 17th, 2005, 08:03 PM
Hi,

This should be simple ... I want to determine the value of an asp:label control in a javascript function on the same aspx page<script language="javascript">
function GetDecisionTreeValue(){
if (document.Form1.lblList.Value == 'Roles') {
window.open('RoleDecisionTree.aspx','Lookup','scrollbars=yes,resizable=yes,status=yes,width=600,heig ht=250');
}
}
</script>Any ideas?

Thx!

nemaroller
Apr 20th, 2005, 08:02 AM
if (document.getElementById('lblList').value == 'Roles')

First, you should use getElementById, it is the accepted standard for the transitional doctype.

Secondly, remember javascript is case sensitive - therefore value needs to be lowercase.

OneSource
Apr 20th, 2005, 08:43 AM
nemaroller, thanks!

OneSource

WALDO
Apr 20th, 2005, 11:24 AM
Labels arent going to have values, they'll have innerText.
if (document.getElementById('lblList').innerText == 'Roles')

nemaroller
Apr 20th, 2005, 01:29 PM
Labels arent going to have values, they'll have innerText.
if (document.getElementById('lblList').innerText == 'Roles')


Thanks for the reminder! lol