Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to show javascript funtion returns value to Label box?

How to show javascript funtion returns value to Label box?

Scheduled Pinned Locked Moved ASP.NET
questionjavajavascripttoolstutorial
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bijeshputhalath
    wrote on last edited by
    #1

    Hi all, I have some java script code like this $8.18 AUD = $ currency_show_conversion(8.18,"AUD","CAD"); The output displays in form as 8.18 AUD= 17.23 CAD like this..... I need to get the values in to a label box,instead of the form.How can i display the values in Label Box.????if anybody having idea please suggest a solution.. Thanks in advance, Bijesh

    L V 2 Replies Last reply
    0
    • B bijeshputhalath

      Hi all, I have some java script code like this $8.18 AUD = $ currency_show_conversion(8.18,"AUD","CAD"); The output displays in form as 8.18 AUD= 17.23 CAD like this..... I need to get the values in to a label box,instead of the form.How can i display the values in Label Box.????if anybody having idea please suggest a solution.. Thanks in advance, Bijesh

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      bijeshputhalath wrote:

      How can i display the values in Label Box.????

      Is this for a web page (HTML)? If so there is no such thing as a "Label Box". You will have to learn HTML well enough to intelligently formulate your question if you want us to help you. For Learning HTML and Javascript try the tutorials at www.w3schools.com as a starting point.

      led mike

      B 1 Reply Last reply
      0
      • L led mike

        bijeshputhalath wrote:

        How can i display the values in Label Box.????

        Is this for a web page (HTML)? If so there is no such thing as a "Label Box". You will have to learn HTML well enough to intelligently formulate your question if you want us to help you. For Learning HTML and Javascript try the tutorials at www.w3schools.com as a starting point.

        led mike

        B Offline
        B Offline
        bijeshputhalath
        wrote on last edited by
        #3

        Hi, Not in HTML Page.I need to show in aspx page . Thanks

        L V 2 Replies Last reply
        0
        • B bijeshputhalath

          Hi, Not in HTML Page.I need to show in aspx page . Thanks

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          bijeshputhalath wrote:

          Not in HTML Page.I need to show in aspx page .

          Wow, I thought I was in a different forum, my fault. :-O This asp.Label

          <asp:Label ID="labelTest" runat="server" Text="Label"></asp:Label>

          Becomes the following in the browser (you can see this by using the browsers "View Source" menu item)

          <span id="labelTest">Label</span>

          So for IE Browser (I don't know about a cross browser solution) the script would be:

          document.getElementById("labelTest").innerText = "Hello World";

          Keep in mind that ASP can alter names if they are nested inside ASP container controls so using the View Source is a way to determine that.

          led mike

          B 1 Reply Last reply
          0
          • B bijeshputhalath

            Hi all, I have some java script code like this $8.18 AUD = $ currency_show_conversion(8.18,"AUD","CAD"); The output displays in form as 8.18 AUD= 17.23 CAD like this..... I need to get the values in to a label box,instead of the form.How can i display the values in Label Box.????if anybody having idea please suggest a solution.. Thanks in advance, Bijesh

            V Offline
            V Offline
            Vasudevan Deepak Kumar
            wrote on last edited by
            #5

            Labels are mostly rendered as SPANs and you can write on them using .innerHTML or .innerText properties.

            Vasudevan Deepak Kumar Personal Homepage
            Tech Gossips
            A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

            B 1 Reply Last reply
            0
            • B bijeshputhalath

              Hi, Not in HTML Page.I need to show in aspx page . Thanks

              V Offline
              V Offline
              Vasudevan Deepak Kumar
              wrote on last edited by
              #6

              bijeshputhalath wrote:

              Not in HTML Page.I need to show in aspx page

              ASPX renders as HTML in the web browser. You mostly need to deal with SPANs, as I guided you in my other reply.

              Vasudevan Deepak Kumar Personal Homepage
              Tech Gossips
              A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

              1 Reply Last reply
              0
              • V Vasudevan Deepak Kumar

                Labels are mostly rendered as SPANs and you can write on them using .innerHTML or .innerText properties.

                Vasudevan Deepak Kumar Personal Homepage
                Tech Gossips
                A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                B Offline
                B Offline
                bijeshputhalath
                wrote on last edited by
                #7

                Hai, Thanks for your help.But how I get values in to Label or text box from that script funtion.If any sample code means it will be very helpful. Thanks and regards Bijesh

                1 Reply Last reply
                0
                • L led mike

                  bijeshputhalath wrote:

                  Not in HTML Page.I need to show in aspx page .

                  Wow, I thought I was in a different forum, my fault. :-O This asp.Label

                  <asp:Label ID="labelTest" runat="server" Text="Label"></asp:Label>

                  Becomes the following in the browser (you can see this by using the browsers "View Source" menu item)

                  <span id="labelTest">Label</span>

                  So for IE Browser (I don't know about a cross browser solution) the script would be:

                  document.getElementById("labelTest").innerText = "Hello World";

                  Keep in mind that ASP can alter names if they are nested inside ASP container controls so using the View Source is a way to determine that.

                  led mike

                  B Offline
                  B Offline
                  bijeshputhalath
                  wrote on last edited by
                  #8

                  Hai, Thanks for your continues help.How can I assign the script funtion returns value in to label or text box ? please give any sample codes. Thanks and regads Bijesh

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups