PDA

View Full Version : Typing Text Script options



green
03-11-2019, 08:14 AM
1) Script Title: Typing Text Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex10/text5.htm

3) Describe problem: I'm finding Twey's Typing Text Script very useful for my students learning English. The students first study and learn a text then test themselves on it by attempting to say the words aloud just before they appear "typed" on the screen.

For this reason, it would be useful to have a pause/play button so the typing can be halted and then resumed. I've searched on the Internet but it seems pausing javascript while running is not straightforward. Additionally and optionally, if possible, although I can control the speed as a variable in the programming, it would be useful if the students could speed up or slow down the appearance of the typing text via a button or similar.

I'm using the "example2" version.

Thanks in advance to any contributions made here.

Mike

green
03-15-2019, 08:47 AM
So this is just not feasible, right? Please let me know. Thanks.

green
03-16-2019, 08:01 PM
Still struggling with this. I have a start button just by calling the function. <button onclick="TypingText.runAll()"> Can't I have another button that will pause the text? And then resume? This is necessary as the texts are long and it gives time for the student to think.

green
04-07-2019, 11:17 AM
I'm surprised you just get ignored here. DD didn't used to be like that. Ho hum.

keyboard
04-07-2019, 11:43 PM
I'm surprised you just get ignored here. DD didn't used to be like that. Ho hum.

Hey Green. Sorry to hear that you feel that. Unfortunately DD Is just a user forum that relies on members of the community to help out. The original writer of that particular script is no longer around.

What you're asking for is possible without any modifications to the script itself.
Please check out the following example page that should have the features you asked for -



<!DOCTYPE html>
<html>
<head>
<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
* Please keep this notice intact
****************************************************/
</script>

</head>
<body>
<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" id="pause" value="pause">
<input type="button" id="resume" value="resume">
<br />
<input type="text" value="100" id="typingSpeed"><input type="button" id="changeSpeed" value="Change Speed">

<script type="text/javascript">

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


document.getElementById("pause").onclick = function() {
typer.running = true;
};

document.getElementById("resume").onclick = function() {
typer.running = false;
typer.run();
};

document.getElementById("changeSpeed").onclick = function() {
var speed = document.getElementById("typingSpeed").value;
typer.interval = speed;
};

typer.run();

</script>

</body>
</html>

green
04-24-2019, 07:49 AM
Hey, Keyboard

Came back to DD for a peek and found your post and solution for the typing text script. Just played around a little with the code and it seems fine. I'm looking forward to getting it up and running for my students. I really appreciate your contribution. Thanks very much.

I hope Twey is continuing his fine work elsewhere.