...

View Full Version : text typing made simple...



chris_angell
02-28-2003, 12:41 PM
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>

chris_angell
02-28-2003, 05:57 PM
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

Roy Sinclair
02-28-2003, 07:41 PM
Are you looking to do something like this (http://www.blaqflame.com/blaqflame/404error.html) ?

chris_angell
03-03-2003, 10:25 AM
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

arnyinc
03-03-2003, 01:42 PM
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=''

chris_angell
03-03-2003, 02:31 PM
lol.. can't believe I missed that... thanks..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum