Consider these changes ...
I did not see the reason for the external text files as you can put the information into an external JS file just as easy. ;)
See if this works for you...:D
Code:
<html>
<head>
<title>Testimonial Displays</title>
<style type="text/css">
.transparent_class {
font-size:2em;
height:150px;
width:400px;
border:5px solid red;
}
</style>
<script type="text/javascript">
var Testimonials = [
['This<br>is<br>great!!'],
['Wonderful in it\'s execution!'],
['Above supercalifragilestic-'],
['Beyond -expedaliocis'],
['Above and beyond<br>supercalifragilesticexpedaliocis'],
['Gees<br>...<p>what a bummer.'] // Note: no comma after last entry
];
var fileInx = 0;
var fadeCnt = 0;
var fadeInc = 5;
function dispTestimonial () {
document.getElementById("testimonials").innerHTML = Testimonials[fileInx]; // +'<p>'+fadeCnt;
document.getElementById('testimonials').style.opacity = (fadeCnt/100).toFixed(2);
document.getElementById('testimonials').style.filter = 'alpha(opacity=' + fadeCnt + ')';
fadeCnt += fadeInc;
if (fadeCnt >= 100) { fadeInc *= -1; }
if (fadeCnt <= 0) {
fadeInc *= -1;
fileInx++;
fileInx = (fileInx % Testimonials.length);
}
}
window.onload = function () {
dispTestimonial()
setInterval("dispTestimonial()", 100);
}
</script>
</head>
<body>
<center>
<div id="testimonials" class="transparent_class"></div>
</center>
</body>
</html>
Good Luck!
:)
No 'java' involved in the script!
None of the code is 'java'. It is all HTML and javascript only.
I was suggesting, if you want to - not necessary, to put the testimonial statements into an external JS file and call it with
Code:
<script type="text/javascript" src="Testimonials.js"></script>
If you do this, DO NOT put any HTML into the external file.
You could also just replace my dummy statements with your own.
Use the example as a template as to how to add the statements into the array.
Either post the code or a link to the program after your attempts.
:)