var r_text = new Array ();
r_text[0] = "Some text";
r_text[1] = "More text";
.
.
.
r_text[50] = "Final text";
var i = Math.round(50*Math.random());
var quote = (r_text[i]);
//The line below is unnecessary
//return quote;
Then in the HTML file I have...
<html>
<head>
<TITLE>Page Title</TITLE>
</head>
<body>
--Stuff in body--
<script src="http://*actual filepath*/array.js" language="javascript" type="text/javascript">
document.writeln(quote);
</script>
</body>
</html>
This should then work fine.
Hope this helps.
m_n
__________________
"Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
-Tommy Cooper
__________________
"Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
-Tommy Cooper
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
Check for errors. If you're using IE, double click the exclamation icon at the left part of the status bar (or enable error notification in the settings). If you're using Firefox or NS7, open the Javascript Console.
A script tag is allowed a src or statements in its body, not both (as alway, IE ignores the standards). Give your document.write its own script tags, or do your document.write at the end of array.js.
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
Quote:
Originally Posted by Harry Armadillo
A script tag is allowed a src or statements in its body, not both (as alway, IE ignores the standards). Give your document.write its own script tags, or do your document.write at the end of array.js.
I didn't notice that.
Or you can just move the document.write statement in the array.js itself so what you have in the body is only the included script.