> > Simple question: how better set font color in script?
> Simple answer: replace following string:
> color: '+document.body.text+';
> with:
> color:red;
> Or create a variable, e.g. ScrollerTextColor and assign it a value:
> var ScrollerTextColor = 'red';
> and refer to it instead of document.body.text.
> Even simpler answer: forget about that script. Them comments:
> //if IE 4+ or NS6
> are a hint of obsoleteness.
> Osmo
---------
OK, I forget about that script.. Here a new code that fully comply
all HTML/CSS standards.
What I want to correct - in fact, it consists of two scripts, that is
not convenient. I want join all in one script. I need also repeat
typewriter(set loop function). To remove background and border, it
seems, i just need remove border, padding, background attributes from
div.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Typewriter Example</title>
</head>
<body>
<h1>Typewriter Effect Example</h1>
<script type="text/javascript">
function Typewriter(sName)
{ // PROPERTIES
this.counter = 0;
this.name = sName;
this.text = "";
this.speed = 50; // in milliseconds
// METHODS
this.addText = AddText;
this.next = Next;
this.setSpeed = SetSpeed;
this.write = Write;
// FUNCTIONS
function AddText(s)
{ this.text = s
}
function Next()
{ document.getElementById('typewriter_output').innerHTML =
this.text.substr(0, this.counter++);
}
function SetSpeed(iSpeed)
{ this.speed = iSpeed;
}
function Write()
{ setInterval(this.name+".next()",this.speed);
}
}
</script>
<div id="typewriter_output" style="width:400px;border:1px black
solid;padding:1em;background:#f3f3f3;"></div>
<script type="text/javascript">
var myTypewriter = new Typewriter("myTypewriter");
myTypewriter.addText("Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Suspendisse eu nisi nec nunc tempor pharetra. Morbi
viverra. Proin scelerisque.");
myTypewriter.write();
</script>
</body>
</html>
mistral
Osmo Saarikumpu - 26 Mar 2007 17:44 GMT
> OK, I forget about that script.. Here a new code that fully comply
> all HTML/CSS standards.
Please upload your code and provide an URL instead of sending code.
> What I want to correct - in fact, it consists of two scripts, that is
> not convenient. I want join all in one script. I need also repeat
> typewriter(set loop function).
Please note Mr. Korpela's advice concerning the correct group. You
should get the above mentioned aspects working before asking for
presentational help.
> To remove background and border, it
> seems, i just need remove border, padding, background attributes from
> div.
Yes. Remove, modify, apply presentation from elsewhere... these all are
more or less trivial matters to be attended after the script's
functionality.
Osmo