Log in

View Full Version : Resolved Typing Text Run only 1 ID at a time when wanted



Taz89
09-19-2012, 07:42 PM
Hi all

i have been reading this forum for hrs and hrs but can't seem to find what i need so maybe you could help me

I'm using Typing Text Script from this website

i have 2 lots of text typed out 1 when the page loads and 1 when a button is clicked to activate a hidden layer of text so as it is i have this


<script type="text/javascript">

//Define first typing text:


//Define second typing text (use "slashing" cursor at the end):
new TypingText(document.getElementById("AText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("SText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
//Type out examples:
TypingText.runAll();
</script>

Now i know that the TypingText.runAll(); is what makes it start typing out the text but how can i stop this from running them all on load and only get it to run the first AText and then to run SText once i add it as a behaviour onclick

as if i add a onclick behaviour to call script TypingText.runAll(); it runs all the typing again and i only want it to run the 1 line i pick

Please Help!!! lol

Thanks in advance i see from alot of the posts around here you guys are good at helping and know your stuff so thank you

bernie1227
09-19-2012, 09:57 PM
Please use encase your code in
tags when posting code.
[code]
<script type="text/javascript">

//Define first typing text:


//Define second typing text (use "slashing" cursor at the end):
functin aText(){
var a = new TypingText(document.getElementById("AText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
typingText.run(a);
}
function sText(){
var s = new TypingText(document.getElementById("SText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
typingText.run(s);
}
</script>


As you can see, there is a function aText and sText, in the body, put:


<body onload="aText">

and then on the thing you want to click, say a button:


<button onclick="sText">

Taz89
09-19-2012, 11:10 PM
hi thanks bernie i just try this copy and pasted your code and even try into a blank page with only this on it and some test still don't work can't seem to make it work

anything i'm missing ? this is what i made in a blank page that did not work


<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Text And More Text And More Text</title>
<script type="text/javascript" src="TypingText.js">
/****************************************************
* Typing Text script- By Twey @ Dynamic Drive Forums
* Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
* This notice MUST stay intact for legal use
****************************************************/
</script>

</head>

<body onload="aText">

<div style="position: absolute; width: 768px; height: 523px; z-index: 1; left: 10px; top: 15px" id="AText">
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text Click button >> <button onclick="aText"></div>

<script type="text/javascript">

//Define first typing text:


//Define second typing text (use "slashing" cursor at the end):
function aText(){
var a = new TypingText(document.getElementById("AText"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
typingText.run(a);
}
</script>
</body>

</html>

bernie1227
09-20-2012, 03:24 AM
<body onload="aText">
Should be:

<body onload="aText()">

Taz89
09-20-2012, 07:59 AM
Hi bernie i did give that a try last night when it did not work i looked up on code with functions etc and i did see that but even that don't work not even clicking the button works even if you add the () it still don't work with the load or button

Thanks

bernie1227
09-20-2012, 08:17 AM
looking at your code, there's a few problems, 1. you should probably put the javascript in the head
2. you never ended the tag for the button.

Taz89
09-20-2012, 08:28 AM
looking at your code, there's a few problems, 1. you should probably put the javascript in the head
2. you never ended the tag for the button.

i have now done both of what you said but still don't work if you would like open a new blank html page and past this in as this is the hole page i using for testing its just a blank page with the script in


<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Text And More Text And More Text</title>
<script type="text/javascript" src="TypingText.js">
/****************************************************
* Typing Text script- By Twey @ Dynamic Drive Forums
* Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
* This notice MUST stay intact for legal use
****************************************************/
</script>
<script type="text/javascript">

//Define first typing text:


//Define second typing text (use "slashing" cursor at the end):
function LoadText(){
var a = new TypingText(document.getElementById("Text"), 20, function(i){ var ar = new Array(" ", " ", " "); return " " + ar[i.length % ar.length]; });
typingText.run(a);
}
</script>
</head>

<body onload="LoadText()">

<div style="position: absolute; width: 768px; height: 523px; z-index: 1; left: 10px; top: 15px" id="Text">
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text Click button >> <button onclick="LoadText()">Click Here</button></div>

</body>

</html>

so what could be wrong lol code all ways fun when you get a problem lol

Thanks

vwphillips
09-20-2012, 09:01 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript" src="TypingText.js">
/****************************************************
* Typing Text script- By Twey @ Dynamic Drive Forums
* Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
* This notice MUST stay intact for legal use
****************************************************/
</script>

</head>

<body>
<div id="example1">Thanks for visiting <a href="http://www.dynamicdrive.com/">Dynamic Drive!</a>
Wow, HTML gets properly typed out too!</div>

<p id="example2">This text has a <b>slashing cursor</b> at the end. <br />And this is on a new line, thanks to the <br> tag.</p>
<input type="button" name="" value="Run Text 2" onmouseup="TypingText.all[1].run()"/>
<script type="text/javascript">
//Define first typing example:
new TypingText(document.getElementById("example1"));

//Define second typing example (use "slashing" cursor at the end):
new TypingText(document.getElementById("example2"), 100, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
TypingText.all[0].run()

//Type out examples:
//TypingText.runAll();
</script>

</body>

</html>

bernie1227
09-20-2012, 09:08 AM
tested and works:


<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Text And More Text And More Text</title>
<script type="text/javascript" src="TypingText.js">
/****************************************************
* Typing Text script- By Twey @ Dynamic Drive Forums
* Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
* This notice MUST stay intact for legal use
****************************************************/
</script>
<script type="text/javascript">

function LoadText(){
new TypingText(document.getElementById("Text"), 100, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
TypingText.runAll();
}

function DoText(){
var thing = document.getElementById("thing");
thing.style.visibility = 'visible';
new TypingText(thing, 100, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
TypingText.runAll();
}
</script>
</head>

<body onload="LoadText()">

<div style="position: absolute; width: 768px; height: 523px; z-index: 1; left: 10px; top: 15px" id="Text">
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text Click button >> </div><button onclick="DoText()">Click Here</button>
<br />
<br />
<br />
<br />
<div id="thing" style="visibility:hidden;">
fishfiasfunjaiweninfinafoijfwij
</div>

</body>

</html>

vwphillips
09-20-2012, 09:28 AM
TypingText.runAll(); runs all instances

TypingText.all[0].run(); runs instance 0

bernie1227
09-20-2012, 09:30 AM
I think my solution is simpler

Taz89
09-20-2012, 10:49 AM
TypingText.runAll(); runs all instances

TypingText.all[0].run(); runs instance 0

thats what was missing

Great thanks you both so much it works perfect now thank you ever so much your great

i hope this also helps anyone else that is looking for the same thing

thank you both again

bernie1227
09-20-2012, 10:53 AM
If this thread is finished, please set it to resolved.
You can do this by editing the first post within the thread - Pressing go advanced - Then where it says no prefix, selecting resolved then save.

Taz89
09-20-2012, 10:59 AM
I think my solution is simpler

Your code is good and it dose work but it did have a problem that when you click the button it runs them both again and if you click the button again it will type out the same text 2 times then if you click the button again it will type out the text 3 times and every time you click the button to type out the hidden text it makes the other text type out faster and faster and faster and faster lol

but once i replaced TypingText.runAll(); with TypingText.all[0].run(); it all works and dose not repeat or speed up other text

so thank you Bernie you was a great help

anyone else that ever needs this done below i added complete working code with the run correction

Thanks All again


<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Text And More Text And More Text</title>
<script type="text/javascript" src="TypingText.js">
/****************************************************
* Typing Text script- By Twey @ Dynamic Drive Forums
* Visit Dynamic Drive for this script and more: http://www.dynamicdrive.com
* This notice MUST stay intact for legal use
****************************************************/
</script>
<script type="text/javascript">

function LoadText(){
new TypingText(document.getElementById("Text"), 100, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
TypingText.all[0].run();
}

function DoText(){
var thing = document.getElementById("thing");
thing.style.visibility = 'visible';
new TypingText(thing, 100, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
TypingText.all[1].run();
}
</script>
</head>

<body onload="LoadText()">

<div style="position: absolute; width: 768px; height: 523px; z-index: 1; left: 10px; top: 15px" id="Text">
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text And More Text And More Text
And More Text And More Text And More Text And More Text And More Text And
More Text And More Text And More Text And More Text And More Text And More
Text And More Text And More Text And More Text Click button >> </div><button onclick="DoText()">Click Here</button>
<br />
<br />
<br />
<br />
<div id="thing" style="visibility:hidden;">
fishfiasfunjaiweninfinafoijfwij
</div>

</body>

</html>

Taz89
09-20-2012, 09:48 PM
Ok maybe not as perfect as i has first seen i have found a problem i guess one not many people really look at but a problem that i need a work around for none the less so...

Ok here is what i have on the script to start typing the wanted line i have

TypingText.all[0].run()
TypingText.all[1].run()
TypingText.all[2].run()
TypingText.all[3].run()
TypingText.all[4].run()

what means when the fuction is activated for the one i want typing out it will type that number line out now my brain automaticly said that line number being first second third would be the order it is in the script when i was testing the new typing on the site on the nav bar i clicked

link 1
link 2
link 3
link 4

what told the script to type line 1 then 2 then 3 then 4 BUT...

if i click the nav bar...

Link 1
Link 4
Link 3
Link 2

then it dose not run them all so....
the first window to open Link 1 types out the text
the second window to open Link 4 dose not type out
the third window to open Link 3 types out the text
the forth window to open Link 2 dose not type out

did you see the problem when you mark TypingText.all[0].run() from 0 to 4 it will only activate the typing if it is the numbers window opened or could say numbered link clicked

so when i clicked link 1 it work as was first link clicked
then when i clicked link 4 it did not work as it was the second link clicked
so when i click link 3 it worked as it was the third link clicked

i hope you can make sense of it all :D

PLEASE HELP!!! lol

bernie1227
09-20-2012, 10:21 PM
The problem I can see, is that you have five different typing text running commands when there are only four typing texts. Arrays start at zero, so [3] would be the fourth item.

Taz89
09-20-2012, 10:43 PM
i do start at zero but TypingText.all[0].run() is all ways open from the page loading so its like...

link 1 TypingText.all[1].run()
link 2 TypingText.all[2].run()
link 3 TypingText.all[3].run()
link 4 TypingText.all[4].run()

so 0 is open already you click 1 it works 2 it works 3 it works 4 it works if you go...

link 1 TypingText.all[1].run() it works as 1 is 2nd open
link 4 TypingText.all[4].run() dose not work as as 4 is 5th
link 3 TypingText.all[3].run() it works as 3 is the 4th open as even tho it did not work link 4 was opened so link 3 is the 4th one activated
link 2 TypingText.all[2].run() don't work as 2 is 3rd and 3rd was link 4 that did not work lol

now here is the twist i think i forgot about when posting last one is that when you click link 3 it makes the text on link 4 type out as in the order i opened the pages in link 4 was the 3rd one to be opened

so to try and make sense...
TypingText.all[0].run() Loads with page so is 1st activated
link 1 TypingText.all[1].run() works when clicked as is 2nd activated
link 4 TypingText.all[4].run() dose not type out when clicked as 4 is 5th activated and this is the 3rd one to be activated
link 3 TypingText.all[3].run() works types out when clicked as 3 is the 4th one activated and this is the 4th one to be activated
link 2 TypingText.all[2].run() dose not type out link 2 as 2 is the 3rd one to be activated but dose type out link 4 as in the order the pages was opened link 4 was the 3rd one to be activated

LOL

Taz89
09-20-2012, 11:06 PM
Thanks for all the help Bernie i have put up a Demo for you to look at so maybe you can understand what i mean http://frogcore.com/Testing/problem.html

bernie1227
09-21-2012, 03:07 AM
Ok, at the moment I don't have time to look at your problem in detail, but I'll be able to look at it in a few hours.

keyboard
09-21-2012, 03:22 AM
Tables for content layout
From the looks of your website, you're using tables for the layout of your content.
Tables can only be used for tabular data! Using tables for layout is depricated by all modern standards!
The correct way to program the layout of your site is using css (http://www.tizag.com/cssT/) and divs (http://www.tizag.com/htmlT/htmldiv.php).
Using tables can bring about a whole pile of problems for your site.
You should never use tables for layout.

Taz89
09-21-2012, 08:18 AM
Tables for content layout
From the looks of your website, you're using tables for the layout of your content.
Tables can only be used for tabular data! Using tables for layout is depricated by all modern standards!
The correct way to program the layout of your site is using css (http://www.tizag.com/cssT/) and divs (http://www.tizag.com/htmlT/htmldiv.php).
Using tables can bring about a whole pile of problems for your site.
You should never use tables for layout.


lol i know its just a fast demo with the coding in place to show the problem thats not my website lol just wooped it together fast so its simple to see :D but thanks

bernie1227
09-21-2012, 08:25 AM
Keyboard, please lay off with that warning, so far you've gotten me into a bit of trouble because you used it. But seriously, leave off with it until the answer has been reached.

vwphillips
09-21-2012, 08:39 AM
<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Click in this order 1</title>
<script type="text/javascript" >
/*
An object-oriented Typing Text script, to allow for multiple instances.
A script that causes any text inside any text element to be "typed out", one letter at a time. Note that any HTML tags will not be included in the typed output, to prevent them from causing problems. Tested in Firefox v1.5.0.1, Opera v8.52, Konqueror v3.5.1, and IE v6.
Browsers that do not support this script will simply see the text fully displayed from the start, including any HTML tags.

Functions defined:
TypingText(element, [interval = 100,] [cursor = "",] [finishedCallback = function(){return}]):
Create a new TypingText object around the given element. Optionally
specify a delay between characters of interval milliseconds.
cursor allows users to specify some HTML to be appended to the end of
the string whilst typing. Optionally, can also be a function which
accepts the current text as an argument. This allows the user to
create a "dynamic cursor" which changes depending on the latest character
or the current length of the string.
finishedCallback allows advanced scripters to supply a function
to be executed on finishing. The function must accept no arguments.

TypingText.run():
Run the effect.

static TypingText.runAll():
Run all TypingText-enabled objects on the page.
*/

TypingText = function(element, interval, cursor, finishedCallback) {
if((typeof document.getElementById == "undefined") || (typeof element.innerHTML == "undefined")) {
this.running = true; // Never run.
return;
}
this.element = element;
this.finishedCallback = (finishedCallback ? finishedCallback : function() { return; });
this.interval = (typeof interval == "undefined" ? 100 : interval);
this.origText = this.element.innerHTML;
this.unparsedOrigText = this.origText;
this.cursor = (cursor ? cursor : "");
this.currentText = "";
this.currentChar = 0;
this.element.typingText = this;
if(this.element.id == "") this.element.id = "typingtext" + TypingText.currentIndex++;
TypingText.all.push(this);
this.running = false;
this.inTag = false;
this.tagBuffer = "";
this.inHTMLEntity = false;
this.HTMLEntityBuffer = "";
}
TypingText.all = new Array();
TypingText.currentIndex = 0;
TypingText.runAll = function() {
for(var i = 0; i < TypingText.all.length; i++) TypingText.all[i].run();
}
TypingText.prototype.run = function() {
if(this.running) return;
if(typeof this.origText == "undefined") {
setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval); // We haven't finished loading yet. Have patience.
return;
}
if(this.currentText == "") this.element.innerHTML = "";
// this.origText = this.origText.replace(/<([^<])*>/, ""); // Strip HTML from text.
if(this.currentChar < this.origText.length) {
if(this.origText.charAt(this.currentChar) == "<" && !this.inTag) {
this.tagBuffer = "<";
this.inTag = true;
this.currentChar++;
this.run();
return;
} else if(this.origText.charAt(this.currentChar) == ">" && this.inTag) {
this.tagBuffer += ">";
this.inTag = false;
this.currentText += this.tagBuffer;
this.currentChar++;
this.run();
return;
} else if(this.inTag) {
this.tagBuffer += this.origText.charAt(this.currentChar);
this.currentChar++;
this.run();
return;
} else if(this.origText.charAt(this.currentChar) == "&" && !this.inHTMLEntity) {
this.HTMLEntityBuffer = "&";
this.inHTMLEntity = true;
this.currentChar++;
this.run();
return;
} else if(this.origText.charAt(this.currentChar) == ";" && this.inHTMLEntity) {
this.HTMLEntityBuffer += ";";
this.inHTMLEntity = false;
this.currentText += this.HTMLEntityBuffer;
this.currentChar++;
this.run();
return;
} else if(this.inHTMLEntity) {
this.HTMLEntityBuffer += this.origText.charAt(this.currentChar);
this.currentChar++;
this.run();
return;
} else {
this.currentText += this.origText.charAt(this.currentChar);
}
this.element.innerHTML = this.currentText;
this.element.innerHTML += (this.currentChar < this.origText.length - 1 ? (typeof this.cursor == "function" ? this.cursor(this.currentText) : this.cursor) : "");
this.currentChar++;
setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval);
} else {
this.currentText = "";
this.currentChar = 0;
this.running = false;
this.finishedCallback();
}
}

</script>

<script type="text/javascript">

function LoadText(){
new TypingText(document.getElementById("Load"), 30, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("first"), 20, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("second"), 20, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("third"), 20, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("fourth"), 20, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
TypingText.all[0].run()
}

function first(){
TypingText.all[1].run()
}

function second(){
TypingText.all[2].run()
}

function third(){
TypingText.all[3].run()
}

function fourth(){
TypingText.all[4].run()
}

function FP_callJS() {//v1.0
eval(arguments[0]);
}
</script>
</head>

<body onload="FP_callJS('LoadText()')">

<table cellpadding="0" cellspacing="0" width="1360" height="488">
<!-- MSTableType="layout" -->
<tr>
<td valign="top" colspan="5" height="68"><button onclick="first()">Click Here 1</button><button onclick="second()">Click Here 2</button><button onclick="third()">Click Here 3</button><button onclick="fourth()">Click Here 4</button>
Click in this order 1, 4, 3, 2 when you click 4 notice text not type out
but when you click 2 it will type out 4</td>
</tr>
<tr>
<td id="Load" valign="top" width="235">
Text Box Load Text Box Load Text Box Load Text Box Load Text Box Load
Text Box Load Text Box Load Text Box Load Text Box Load Text Box Load
Text Box Load Text Box Load Text Box Load Text Box Load Text Box Load
Text Box Load Text Box Load </td>
<td id="first" valign="top" width="268">
Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text
Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1
Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 </td>
<td id="second" valign="top" width="267">
Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text
Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2
Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 </td>
<td id="third" valign="top" width="252">
Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text
Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3
Text Box 3 </td>
<td id="fourth" valign="top" height="420" width="338">
Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text
Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4
Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 </td>
</tr>
</table>

</body>

</html>

keyboard
09-21-2012, 08:50 AM
lol i know its just a fast demo with the coding in place to show the problem thats not my website lol just wooped it together fast so its simple to see :D but thanks

That's fine!

P.s. bernie: What trouble?

Taz89
09-21-2012, 09:45 AM
<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Click in this order 1</title>
<script type="text/javascript" >
/*
An object-oriented Typing Text script, to allow for multiple instances.
A script that causes any text inside any text element to be "typed out", one letter at a time. Note that any HTML tags will not be included in the typed output, to prevent them from causing problems. Tested in Firefox v1.5.0.1, Opera v8.52, Konqueror v3.5.1, and IE v6.
Browsers that do not support this script will simply see the text fully displayed from the start, including any HTML tags.

Functions defined:
TypingText(element, [interval = 100,] [cursor = "",] [finishedCallback = function(){return}]):
Create a new TypingText object around the given element. Optionally
specify a delay between characters of interval milliseconds.
cursor allows users to specify some HTML to be appended to the end of
the string whilst typing. Optionally, can also be a function which
accepts the current text as an argument. This allows the user to
create a "dynamic cursor" which changes depending on the latest character
or the current length of the string.
finishedCallback allows advanced scripters to supply a function
to be executed on finishing. The function must accept no arguments.

TypingText.run():
Run the effect.

static TypingText.runAll():
Run all TypingText-enabled objects on the page.
*/

TypingText = function(element, interval, cursor, finishedCallback) {
if((typeof document.getElementById == "undefined") || (typeof element.innerHTML == "undefined")) {
this.running = true; // Never run.
return;
}
this.element = element;
this.finishedCallback = (finishedCallback ? finishedCallback : function() { return; });
this.interval = (typeof interval == "undefined" ? 100 : interval);
this.origText = this.element.innerHTML;
this.unparsedOrigText = this.origText;
this.cursor = (cursor ? cursor : "");
this.currentText = "";
this.currentChar = 0;
this.element.typingText = this;
if(this.element.id == "") this.element.id = "typingtext" + TypingText.currentIndex++;
TypingText.all.push(this);
this.running = false;
this.inTag = false;
this.tagBuffer = "";
this.inHTMLEntity = false;
this.HTMLEntityBuffer = "";
}
TypingText.all = new Array();
TypingText.currentIndex = 0;
TypingText.runAll = function() {
for(var i = 0; i < TypingText.all.length; i++) TypingText.all[i].run();
}
TypingText.prototype.run = function() {
if(this.running) return;
if(typeof this.origText == "undefined") {
setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval); // We haven't finished loading yet. Have patience.
return;
}
if(this.currentText == "") this.element.innerHTML = "";
// this.origText = this.origText.replace(/<([^<])*>/, ""); // Strip HTML from text.
if(this.currentChar < this.origText.length) {
if(this.origText.charAt(this.currentChar) == "<" && !this.inTag) {
this.tagBuffer = "<";
this.inTag = true;
this.currentChar++;
this.run();
return;
} else if(this.origText.charAt(this.currentChar) == ">" && this.inTag) {
this.tagBuffer += ">";
this.inTag = false;
this.currentText += this.tagBuffer;
this.currentChar++;
this.run();
return;
} else if(this.inTag) {
this.tagBuffer += this.origText.charAt(this.currentChar);
this.currentChar++;
this.run();
return;
} else if(this.origText.charAt(this.currentChar) == "&" && !this.inHTMLEntity) {
this.HTMLEntityBuffer = "&";
this.inHTMLEntity = true;
this.currentChar++;
this.run();
return;
} else if(this.origText.charAt(this.currentChar) == ";" && this.inHTMLEntity) {
this.HTMLEntityBuffer += ";";
this.inHTMLEntity = false;
this.currentText += this.HTMLEntityBuffer;
this.currentChar++;
this.run();
return;
} else if(this.inHTMLEntity) {
this.HTMLEntityBuffer += this.origText.charAt(this.currentChar);
this.currentChar++;
this.run();
return;
} else {
this.currentText += this.origText.charAt(this.currentChar);
}
this.element.innerHTML = this.currentText;
this.element.innerHTML += (this.currentChar < this.origText.length - 1 ? (typeof this.cursor == "function" ? this.cursor(this.currentText) : this.cursor) : "");
this.currentChar++;
setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval);
} else {
this.currentText = "";
this.currentChar = 0;
this.running = false;
this.finishedCallback();
}
}

</script>

<script type="text/javascript">

function LoadText(){
new TypingText(document.getElementById("Load"), 30, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("first"), 20, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("second"), 20, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("third"), 20, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
new TypingText(document.getElementById("fourth"), 20, function(i){ var ar = new Array("\\", "|", "/", "-"); return " " + ar[i.length % ar.length]; });
TypingText.all[0].run()
}

function first(){
TypingText.all[1].run()
}

function second(){
TypingText.all[2].run()
}

function third(){
TypingText.all[3].run()
}

function fourth(){
TypingText.all[4].run()
}

function FP_callJS() {//v1.0
eval(arguments[0]);
}
</script>
</head>

<body onload="FP_callJS('LoadText()')">

<table cellpadding="0" cellspacing="0" width="1360" height="488">
<!-- MSTableType="layout" -->
<tr>
<td valign="top" colspan="5" height="68"><button onclick="first()">Click Here 1</button><button onclick="second()">Click Here 2</button><button onclick="third()">Click Here 3</button><button onclick="fourth()">Click Here 4</button>
Click in this order 1, 4, 3, 2 when you click 4 notice text not type out
but when you click 2 it will type out 4</td>
</tr>
<tr>
<td id="Load" valign="top" width="235">
Text Box Load Text Box Load Text Box Load Text Box Load Text Box Load
Text Box Load Text Box Load Text Box Load Text Box Load Text Box Load
Text Box Load Text Box Load Text Box Load Text Box Load Text Box Load
Text Box Load Text Box Load </td>
<td id="first" valign="top" width="268">
Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text
Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1
Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 Text Box 1 </td>
<td id="second" valign="top" width="267">
Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text
Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2
Text Box 2 Text Box 2 Text Box 2 Text Box 2 Text Box 2 </td>
<td id="third" valign="top" width="252">
Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text
Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3 Text Box 3
Text Box 3 </td>
<td id="fourth" valign="top" height="420" width="338">
Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text
Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4
Text Box 4 Text Box 4 Text Box 4 Text Box 4 Text Box 4 </td>
</tr>
</table>

</body>

</html>

that worked GREAT 100% perfect thank you ever so much made a little more simple thank you all for your help that is great

thanks for all your time Bernie and thank you for taking the time to help and thank you Phillips for the help thanks for all your time taken to help

bernie1227
09-22-2012, 02:01 AM
That's fine!

P.s. bernie: What trouble?

it does not matter, just that you should discontinue going giving that warning without looking at the thread.

keyboard
09-22-2012, 02:07 AM
it does not matter, just that you should discontinue going giving that warning without looking at the thread.

I did read through the thread. On his test page, he did use tables and I wasn't sure if he'd do that in a real page too, so I did what I did.
P.s. it's not a warning, more of a suggestion...

bernie1227
09-22-2012, 03:09 AM
my statement applies to every time you use that, for example in the other thread, you gave the warning without even reading the code properly.

jscheuer1
09-22-2012, 03:28 AM
I don't think tables has anything to do with it. And I agree with Bernie if he's saying that you shouldn't just paste that boiler plate about tables in everywhere you see a table without also giving actual advice on how to solve the issue of the thread. Remember, although using tables for layout isn't always the best idea, rarely (though sometimes) is simply using divs in their place a solution to a javascript problem.