Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

News-ticker problems...

CrimmoCrimmo Posts: 4Member
Hello there,

I'm having a bit of trouble pausing the readout of text in a quick news-ticker test script. It's supposed to write each letter to the screen one at a time, as though it's being typed, but it's waiting until the script has executed fully before just displaying the lot in one go (similar to the way Java "self-optimises" code).

How do I make the code wait a few hundred milliseconds between loops? Cheers.

[code]


Testing Javascript Readout










[/code]

Comments

  • NCS_OneNCS_One Posts: 170Member
    : Hello there,
    :
    : I'm having a bit of trouble pausing the readout of text in a quick news-ticker test script. It's supposed to write each letter to the screen one at a time, as though it's being typed, but it's waiting until the script has executed fully before just displaying the lot in one go (similar to the way Java "self-optimises" code).
    :
    : How do I make the code wait a few hundred milliseconds between loops? Cheers.
    :
    : [code]
    :
    :
    : Testing Javascript Readout
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    : [/code]
    :

    Hi

    Next time try doing a search.

    Here are 2 sleep functions :
    http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=35&MsgID=325430&Setting=A9999F0005

    Hope it helps.
  • CrimmoCrimmo Posts: 4Member
    : : Hello there,
    : :
    : : I'm having a bit of trouble pausing the readout of text in a quick news-ticker test script. It's supposed to write each letter to the screen one at a time, as though it's being typed, but it's waiting until the script has executed fully before just displaying the lot in one go (similar to the way Java "self-optimises" code).
    : :
    : : How do I make the code wait a few hundred milliseconds between loops? Cheers.
    : :
    : : [code]
    : :
    : :
    : : Testing Javascript Readout
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : : [/code]
    : :
    :
    : Hi
    :
    : Next time try doing a search.
    :
    : Here are 2 sleep functions :
    : http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=35&MsgID=325430&Setting=A9999F0005
    :
    : Hope it helps.
    :

    Hi NCS_One, you won't remember me (when I'm not in work I post under the name "Snookerloopy") but some of your Java advice helped me through my Masters last year, so thanks. I appreciate your help a lot.

    I did search for help on this matter before I posted, I searched for "news ticker" and a few other terms but nothing helpful came up.

    I tried the code you just recommended, but I can't get it to work. It's still pretty much the same as before, all of the text comes up at once, having initially waited the full amount of time for all the combined iterations.

    Can you suggest where I might be going wrong?
  • NCS_OneNCS_One Posts: 170Member
    [b][red]This message was edited by NCS_One at 2006-7-24 14:18:19[/red][/b][hr]
    [b][red]This message was edited by NCS_One at 2006-7-24 14:14:3[/red][/b][hr]
    : : : Hello there,
    : : :
    : : : I'm having a bit of trouble pausing the readout of text in a quick news-ticker test script. It's supposed to write each letter to the screen one at a time, as though it's being typed, but it's waiting until the script has executed fully before just displaying the lot in one go (similar to the way Java "self-optimises" code).
    : : :
    : : : How do I make the code wait a few hundred milliseconds between loops? Cheers.
    : : :
    : : : [code]
    : : :
    : : :
    : : : Testing Javascript Readout
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : : [/code]
    : : :
    : :
    : : Hi
    : :
    : : Next time try doing a search.
    : :
    : : Here are 2 sleep functions :
    : : http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=35&MsgID=325430&Setting=A9999F0005
    : :
    : : Hope it helps.
    : :
    :
    : Hi NCS_One, you won't remember me (when I'm not in work I post under the name "Snookerloopy") but some of your Java advice helped me through my Masters last year, so thanks. I appreciate your help a lot.
    :
    : I did search for help on this matter before I posted, I searched for "news ticker" and a few other terms but nothing helpful came up.
    :
    : I tried the code you just recommended, but I can't get it to work. It's still pretty much the same as before, all of the text comes up at once, having initially waited the full amount of time for all the combined iterations.
    :
    : Can you suggest where I might be going wrong?
    :

    Hi

    You can not do it with a delay or FOR because HTML only is
    writen to the document after the javascript function is over,
    and in that case when the function ends the string is all in
    the element, so it shows it all.

    Here goes a simple way of doing it :

    [code]


    Teste7




    var ToWrite = "aeiou";
    var Count = 0;
    function WriteIt()
    {
    Div1.innerText += ToWrite.substring(Count, Count+1);
    if (Count == ToWrite.length - 1)
    {
    clearInterval(WriteInterval);
    }
    Count++;
    }
    var WriteInterval = window.setInterval("WriteIt()", 1000);



    [/code]

    And here you can find one more difficult :
    http://www.dynamicdrive.com/dynamicindex10/text5.htm

    Hope it helps.




  • CrimmoCrimmo Posts: 4Member
    : [b][red]This message was edited by NCS_One at 2006-7-24 14:18:19[/red][/b][hr]
    : [b][red]This message was edited by NCS_One at 2006-7-24 14:14:3[/red][/b][hr]
    : : : : Hello there,
    : : : :
    : : : : I'm having a bit of trouble pausing the readout of text in a quick news-ticker test script. It's supposed to write each letter to the screen one at a time, as though it's being typed, but it's waiting until the script has executed fully before just displaying the lot in one go (similar to the way Java "self-optimises" code).
    : : : :
    : : : : How do I make the code wait a few hundred milliseconds between loops? Cheers.
    : : : :
    : : : : [code]
    : : : :
    : : : :
    : : : : Testing Javascript Readout
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : : [/code]
    : : : :
    : : :
    : : : Hi
    : : :
    : : : Next time try doing a search.
    : : :
    : : : Here are 2 sleep functions :
    : : : http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=35&MsgID=325430&Setting=A9999F0005
    : : :
    : : : Hope it helps.
    : : :
    : :
    : : Hi NCS_One, you won't remember me (when I'm not in work I post under the name "Snookerloopy") but some of your Java advice helped me through my Masters last year, so thanks. I appreciate your help a lot.
    : :
    : : I did search for help on this matter before I posted, I searched for "news ticker" and a few other terms but nothing helpful came up.
    : :
    : : I tried the code you just recommended, but I can't get it to work. It's still pretty much the same as before, all of the text comes up at once, having initially waited the full amount of time for all the combined iterations.
    : :
    : : Can you suggest where I might be going wrong?
    : :
    :
    : Hi
    :
    : You can not do it with a delay or FOR because HTML only is
    : writen to the document after the javascript function is over,
    : and in that case when the function ends the string is all in
    : the element, so it shows it all.
    :
    : Here goes a simple way of doing it :
    :
    : [code]
    :
    :
    : Teste7
    :
    :
    :

    :
    : var ToWrite = "aeiou";
    : var Count = 0;
    : function WriteIt()
    : {
    : Div1.innerText += ToWrite.substring(Count, Count+1);
    : if (Count == ToWrite.length - 1)
    : {
    : clearInterval(WriteInterval);
    : }
    : Count++;
    : }
    : var WriteInterval = window.setInterval("WriteIt()", 1000);
    :
    :
    :
    : [/code]
    :
    : And here you can find one more difficult :
    : http://www.dynamicdrive.com/dynamicindex10/text5.htm
    :
    : Hope it helps.
    :
    :
    :
    :
    :
    Thanks NCS, I'll give that a go :)
Sign In or Register to comment.