Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    text typing made simple...

    hello. I am trying to get two boxes of text to type pain text in two areas, I have done some code and assigned two lots of text typing into boxes.. but if you run the code, in the second box it is going crazy.. what can I do ??? any ideas.. i can't puzzle out the if statment ???

    <html>

    <head>
    </head>

    <body>
    <script language="JavaScript1.2">


    var it=0
    function initialize(){
    mytext=typing.innerText
    mytext1=typing1.innerText
    typing.innerText=''
    typeit()
    }
    function typeit(){
    typing.insertAdjacentText("beforeEnd",mytext.charAt(it))
    typing1.insertAdjacentText("beforeEnd",mytext1.charAt(it))
    if (it<mytext.length-1){
    it++
    setTimeout("typeit()",100)
    }
    else
    return
    }
    if (document.all)
    document.body.onload=initialize
    </script>

    <table border="1" cellspacing="1" width="100%" id="AutoNumber1">
    <tr>
    <td id="typing" width="100%">test typing</td>
    </tr>
    <tr>
    <td id="typing1" width="100%">test typing 1</td>
    </tr>
    </table>

    </body>
    Last edited by chris_angell; 02-28-2003 at 05:45 PM.
    <marquee>thanks</marquee>

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    I will try to explain better

    after reading the above text I realised it didn.t really make scense.. this is what I am trying to do.

    I want some text to type when you load the page ie

    h
    he
    hel
    hell
    hello

    but on the same line... I can get one going but to put two seperate pieces of text typing together is mucking up/... hope this make more scense... but if you look at the code you will see what I mean...

    thanks again
    <marquee>thanks</marquee>

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Are you looking to do something like this ?

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    um no.. not in a form

    if you go here you might see what I am trying to do ??

    http://www.connectonlinepreview.co.uk/test.htm

    from the link the two bits of text should just type out test typing.. but for some reason the lower one types test typing 1test typing

    and I am not to sure why.. any help
    <marquee>thanks</marquee>

  • #5
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    In the HTML, both of the TD cells have text in them

    <td id="typing" width="100%">test typing </td>

    <td id="typing1" width="100%">test typing </td>

    In the javascript, the first cell is set equal to '' so just do the same thing for the second cell also.

    typing.innerText=''
    typing1.innerText=''

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    thanks

    lol.. can't believe I missed that... thanks..
    <marquee>thanks</marquee>


  •  

    Posting Permissions

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