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. javascript typing effect

javascript typing effect

Scheduled Pinned Locked Moved Web Development
helpjavascript
3 Posts 2 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.
  • R Offline
    R Offline
    rgoyal
    wrote on last edited by
    #1

    I am trying a javascript typing effect. I am facing problem in giving delay between printing of two characters. I tried setTimeout but is not working as shown below: <!-- var str="good evening"; var ctr=0; function show() { while(ctr<str.length) { document.write(str.charAt(ctr)); <br>/* This is not working: setTimeout(document.write(str.charAt(ctr),50) */</b> ctr++; } } --> show(); Please help Ranjan Goyal

    S 1 Reply Last reply
    0
    • R rgoyal

      I am trying a javascript typing effect. I am facing problem in giving delay between printing of two characters. I tried setTimeout but is not working as shown below: <!-- var str="good evening"; var ctr=0; function show() { while(ctr<str.length) { document.write(str.charAt(ctr)); <br>/* This is not working: setTimeout(document.write(str.charAt(ctr),50) */</b> ctr++; } } --> show(); Please help Ranjan Goyal

      S Offline
      S Offline
      Sven Cipido
      wrote on last edited by
      #2

      Hi, This is what you need to do : function show() { var typeLength= str.length document.typewriterScreen.typepage.value= document.typewriterScreen.typepage.value + str.charAt(i) i++ var timeID= setTimeout("show()",50) } In my case typewritescreen is my form and typepage is my textarea. But you could use your document property. What's happen is that the code var timeID= setTimeout("show()",50) sets a time out for the script of 50/1000 of a second before it runs through the function again. Hopes this helps you out

      R 1 Reply Last reply
      0
      • S Sven Cipido

        Hi, This is what you need to do : function show() { var typeLength= str.length document.typewriterScreen.typepage.value= document.typewriterScreen.typepage.value + str.charAt(i) i++ var timeID= setTimeout("show()",50) } In my case typewritescreen is my form and typepage is my textarea. But you could use your document property. What's happen is that the code var timeID= setTimeout("show()",50) sets a time out for the script of 50/1000 of a second before it runs through the function again. Hopes this helps you out

        R Offline
        R Offline
        rgoyal
        wrote on last edited by
        #3

        I tried following and it is not working. But I can write on the status bar as shown below in commented portion. Moreover I don't want to write in the textbox but on the document. <!-- var str="good evening"; var i=0; function show() { var typeLength= str.length document.typewriterScreen.typepage.value= document.typewriterScreen.typepage.value + str.charAt(i) i++ var timeID= setTimeout("show()",50) /* //For printing on status bar if(ctr<=str.length) { window.status = str.substring(0, ctr++) + "_"; setTimeout("show()",200); if(ctr == str.length) { window.status = str.substring(0, ctr) + "_"; ctr=0; } } */ } -->

        Please Help. Ranjan

        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