How to update a label using Javascript?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gnewsgroup

    How to update a label using Javascript?

    In my asp.net 2.0 web application, I would like to display the process
    progress information in the browser. The progress info is displayed
    one after another with 1 or 2 seconds delay in between them. I
    believe you guys have seen this a lot in a DOS console.

    I have been trying this in my code-behind in C# for a few days with no
    luck.

    I think this must be achievable through javascript. But, I am new to
    javascript, could you guys give me a hint on how to do this in
    javascript? Thanks.
  • Randy Webb

    #2
    Re: How to update a label using Javascript?

    My Pet Programmer said the following on 12/23/2007 5:08 PM:
    David Mark said:
    >As written, there is no way to stop this interval.
    >
    You're right, I didn't put a stop in. He should only have it run during
    the update and then stop. Excellent point, I should have paid better
    attention to detail.
    And at least tested it before you posted it :)
    >Why getTimeMillis?
    >
    Is there a performance hit, or just a curiosity.
    There is always a "performanc e hit" when you use a property that doesn't
    exist.
    It makes it clearer what I'm doing in the code, I think. If it's inefficient, let me know
    and I'll just comment better.
    See my other reply to you about using a queryString.
    Ok, so an updated code listing then:
    >
    <script type="text/javascript">
    <snipped a lot of code to do a 3 line project>
    Is that a little beter?
    Not really :)

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

    Comment

    • My Pet Programmer

      #3
      Re: How to update a label using Javascript?

      Randy Webb said:
      >
      I'm not sure how to take that.
      >
      It was meant respectfully. I'm going to lay back and watch for a while,
      since it seems I'm not paying any attention to detail.

      ~A!

      Comment

      • Randy Webb

        #4
        Re: How to update a label using Javascript?

        My Pet Programmer said the following on 12/23/2007 6:29 PM:
        Randy Webb said:
        >>
        >I'm not sure how to take that.
        >>
        >
        It was meant respectfully. I'm going to lay back and watch for a while,
        since it seems I'm not paying any attention to detail.
        Fair enough and thank you for a compliment.

        Don't just "lay back" though. You will learn a lot quicker if you take a
        post that interest you, try to come up with a solution, then test it.
        Then try to break it, then test it some more, then see how it stands up
        and compares to other solutions posted.

        And get Firefox :)

        --
        Randy
        Chance Favors The Prepared Mind
        comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
        Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

        Comment

        • Randy Webb

          #5
          Re: How to update a label using Javascript?

          My Pet Programmer said the following on 12/23/2007 6:35 PM:
          David Mark said:
          >On Dec 23, 5:08 pm, My Pet Programmer <anth...@mypetp rogrammer.com>
          >wrote:
          <snip>
          >>And the usage would be:
          >>>
          >>var updater = new StatusUpdater(" myImageId", "myLabelId" );
          >>updater.start ();
          >>updater.stop( );
          >>>
          >>And you'd call updater.start() when you started the remote procedure,
          >>then updater.stop() when you finished.
          >>>
          >>Is that a little beter?
          >>
          >Not really.
          >
          Ok, you got me, I shouldn't have replied to this at all. I don't know
          what the hell I'm even thinking today, but I sure as hell shouldn't be
          writing code I don't know enough about.
          And if you don't write it, you won't learn it, and where will that get
          you? I have had my head bashed in so many times here over code I posted
          I stopped letting it bother me.

          --
          Randy
          Chance Favors The Prepared Mind
          comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
          Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

          Comment

          • My Pet Programmer

            #6
            Re: How to update a label using Javascript?

            Randy Webb said:
            My Pet Programmer said the following on 12/23/2007 6:29 PM:
            >Randy Webb said:
            >>>
            >>I'm not sure how to take that.
            >>>
            >>
            >It was meant respectfully. I'm going to lay back and watch for a
            >while, since it seems I'm not paying any attention to detail.
            >
            Fair enough and thank you for a compliment.
            >
            Don't just "lay back" though. You will learn a lot quicker if you take a
            post that interest you, try to come up with a solution, then test it.
            Then try to break it, then test it some more, then see how it stands up
            and compares to other solutions posted.
            >
            And get Firefox :)
            >
            Firefox is my primary, I only use IE at all because I have to test in
            it. I usually build in FF, get it right, then test in IE and work around
            broken stuff, which is getting less each time, with the help of folks
            just like you.

            ~A!

            Comment

            • My Pet Programmer

              #7
              Re: How to update a label using Javascript?

              Randy Webb said:
              And if you don't write it, you won't learn it, and where will that get
              you? I have had my head bashed in so many times here over code I posted
              I stopped letting it bother me.
              >
              Sounds like a plausible way to look at things, thanks for that. I'm
              reading that best practices doc over at Javascript Toolbox right now,
              actually.

              ~A!

              Comment

              • Dr J R Stockton

                #8
                Re: How to update a label using Javascript?

                In comp.lang.javas cript message <fkmjnj$q27$1@r egistered.motza rella.org>
                , Sun, 23 Dec 2007 16:25:02, My Pet Programmer
                <anthony@mypetp rogrammer.compo sted:
                new Date().getTimeM illis();
                Which browsers implement that?

                Please post only code that has been tested, and use copy'n'paste to do
                it.

                --
                (c) John Stockton, Surrey, UK. ???@merlyn.demo n.co.uk Turnpike v6.05 MIME.
                Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
                Check boilerplate spelling -- error is a public sign of incompetence.
                Never fully trust an article from a poster who gives no full real name.

                Comment

                • ~A!

                  #9
                  Re: How to update a label using Javascript?

                  On Dec 24, 1:06 pm, Dr J R Stockton <j...@merlyn.de mon.co.ukwrote:
                  In comp.lang.javas cript message <fkmjnj$q2...@r egistered.motza rella.org>
                  , Sun, 23 Dec 2007 16:25:02, My Pet Programmer
                  <anth...@mypetp rogrammer.compo sted:
                  >
                  new Date().getTimeM illis();
                  >
                  Which browsers implement that?
                  >
                  Please post only code that has been tested, and use copy'n'paste to do
                  it.
                  >
                  None, actually. It was an egregious and disgusting public display of
                  incompetence and lack of attention to detail. I've learned my lesson,
                  and I will not let it happen again.

                  ~A!

                  Comment

                  Working...