Results 1 to 5 of 5

Thread: asp:Label and Javascript

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Question asp:Label and Javascript

    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
    Code:
    <script language="javascript">
    function GetDecisionTreeValue(){
    				if (document.Form1.lblList.Value == 'Roles') {
    				window.open('RoleDecisionTree.aspx','Lookup','scrollbars=yes,resizable=yes,status=yes,width=600,height=250');
    				}
    			}
    		</script>
    Any ideas?

    Thx!

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: asp:Label and Javascript

    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.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Re: asp:Label and Javascript

    nemaroller, thanks!

    OneSource

  4. #4
    Addicted Member WALDO's Avatar
    Join Date
    Aug 2002
    Location
    Swing of Prussia, PA
    Posts
    244

    Lightbulb Thirdly,

    Labels arent going to have values, they'll have innerText.
    Code:
    if (document.getElementById('lblList').innerText == 'Roles')

  5. #5
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: Thirdly,

    Quote Originally Posted by WALDO
    Labels arent going to have values, they'll have innerText.
    Code:
    if (document.getElementById('lblList').innerText == 'Roles')
    Thanks for the reminder! lol

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width