Trying to insert both of these arrays of random quotes on the same page so that both show at the same time. I realize I have to rename some of the elements within, but apparently I have no clue which. I've tried giving each rannum, ShowText, and RndText a number behind it, but that didn't work. I'm sure there's just something small I'm missing. Any help would be greatly appreciated. Thanks!

<div>

<!-- Math Conversation -->


<script type="text/javascript">
var textarray = [
"The most incomprehensible about Mathematics is that it is comprehensible.",
"Arithmetic is where numbers fly like pigeons in and out of your head. ",
"Black holes result from God dividing the universe by zero. ",
"Geometry is not true, it is advantageous. ",
"I love mathematics because it allows for no hypocrisy and no vagueness.",
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.",
"In mathematics the art of proposing a question must be held of higher value than solving it.",
"In mathematics you don't understand things. You just get used to them.",
"In the binary system we count on our fists instead of on our fingers. ",
"Infinity is a floorless room without walls or ceiling. ",
"Math is radical! Get it?...",
"Mathematics are well and good but nature keeps dragging us around by the nose. ",
"Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.",
"Mathematics is the supreme judge; from its decisions there is no appeal. ",
"Proof is an idol before whom the pure mathematician tortures himself.",
"Pure mathematics is, in its way, the poetry of logical ideas. ",
"Sometimes it is useful to know how large your zero is. ",
"Still more astonishing is that world of rigorous fantasy we call mathematics. ",
"The essence of mathematics is to make complicated things simple. ",
"The highest form of pure thought is in mathematics",
"The human mind has never invented a labor-saving machine equal to algebra. ",
"The pulse of the earth is mathematics",
"There are 10 types of people in this world:  those who understand binary and those who don't. ",
"Trigonometry is a sine of the times.  ",
"Why is it still Train A and Train B? Aren't Planes more modern?",
"I've always loved math for its objectivity. ",
"Chances are, the answer is 5. ",
"So many theorems, such little time. ",
"I'm so smart, I can divide by zero. ",
"You either master math or it masters you. It's unavoidable. ",
"We'll get as far ahead in math as time allows. ",
"If you don’t make mistakes, you’re not working on hard enough problems. And that’s a big mistake.",
"Why do nerds confuse Halloween and Christmas? Because OCT31=DEC25",   // No comma after last entry
];

function RndText() {
  var rannum= Math.floor(Math.random()*textarray.length);
  document.getElementById('ShowText').innerHTML=textarray[rannum];
}
onload = function() { RndText(); }

</script>

<center>
<table width="950" class="math"><tr><td align="center">
<img src="https://dl.dropboxusercontent.com/u/5739741/Images/Prodigies/default-divider.png" width="900"/>
</td></tr><tr><td align="center">
<div id="ShowText" class="sentient"></div>
</td></tr><tr><td align="center">
<img src="https://dl.dropboxusercontent.com/u/5739741/Images/Prodigies/default-divider.png" width="900"/>
</td></tr></table></center>
</div>











<div>

<!-- POSTS Conversation -->


<script type="text/javascript">
var textarray = [
"The road to success is always under construction.",
"Life is like a ten-speed bike. Most of us have gears we never use.",
"The greatest pleasure in life is doing what people say you cannot do.",
"Disclaimer: I'm not as smart as I think I am.  ",
"I'm not paranoid, but everyone thinks I am...",
"Out of my mind. Back in five minutes. ",
"If you try to fail, and succeed, which have you done? ",
"Why is a wise man and a wise guy opposites? ",
"Why is 'abbreviation' such a long word? ",
"It's so simple to be wise. Just think of something stupid to say and then don't say it. ",
"Shhh... people will believe anything, if you whisper it. ",
"Never test the depth of the water with both feet. ",
"I know what you're thinking... and I'm flattered!",
"pr0digies is definitely the place to be!",
"You again???? What are you up to?",
"Close your eyes, take a deep breath, then read. WAIT, open your eyes first!",
"I know you just love reading these...",
"Sit back, relax, and take in a few more posts.",
"This is one of my favorite posts. Hope you like it.",
"Some interesting stuff, huh?",
"How's your day going? I hope well.",
"I hope you enjoy this post.",
"I hope I'm not bugging you.",
"Thanks for READING MORE. We're totally friends now.",
"It's been nice catching up with you.",
"You're the best!",
"People like you make the world a better place.",
"Nice click!",
"Thanks for being awesome.",
"Wanna hear a joke? [insert arbitrary punchline]",
"You really like reading these, don't you? :-)",
"This program is great, huh?!",
"Hahahahaha!!! Wait, are you laughing too? ",
"Hurry up and read the post! It's a good one.",
"OMG, I can't wait to see what happens next!",
"Well..... Are you gonna comment on this post or not?",
"Have you subscribed yet???? Just enter your email up top.",
"Thanks for keeping track of our day to day.",
"I really appreciate your attention.",
"Be sure to read every post so that you don't miss a thing.",
"Warning: Don't leave the website without saying hi. Politeness counts.",
"Make sure you click on your favorite facet linked below on the right.",
"Caution: Leaving this website may be harmful for your health.",
"Why'd you do that?!",
"So... whatcha readin'?",
"How much wood could a woodchuck chuck if a woodchuck could chuck would?",
"Why do you keep reading these statements I post?",
"The only thing worse than being blind is having sight but no vision.",
"Whether you think you can or think you can’t, you’re right.",
"Life has two rules: #1 Never quit #2 Always remember rule # 1.",
"Even if you’re on the right track, you’ll get run over if you just sit there.",
"Obstacles are those frightful things you see when you take your eyes off your goal.",
"The complexity of simplicity is paradoxical in its hypocrisy. What?!",
"The romanticism of omniscience is sociological in its foresight. What?!",
"The integrity of reciprocity is hardly trivial in its deviousness. What?!",
"I’m not random! I just have lots of thoughts.",
"Love your enemies, it makes them angry",
"In order to succeed, your desire for success should be greater than your fear of failure.",
"The greatest obstacle to discovery is not ignorance; it is the illusion of knowledge.",
"Success consists of going from failure to failure without loss of enthusiasm.",
"Mistakes are the portals of discovery.",
"You can never get enough of what you don’t really need.",
"I don’t know the key to success, but the key to failure is trying to please everybody.",
"I hear: I forget / I see: I remember / I do: I understand",
"Discipline is just choosing between what you want now and what you want most.",
"If opportunity doesn’t knock, build a door.",
"It is our choices, that show what we truly are, far more than our abilities.",
"If you genuinely want something, don’t wait for it – teach yourself to be impatient.",
"A witty saying proves nothing.",
"An ounce of emotion is equal to a ton of facts.",
"No one can make you feel inferior without your consent. "  // No comma after last entry
];

function RndText2() {
  var rannum2= Math.floor(Math.random()*textarray.length);
  document.getElementById('ShowText2').innerHTML=textarray[rannum2];
}
onload = function() { RndText2(); }

</script>

<center>
<table width=950 class="posts"><tr><td align="center">
<img src="https://dl.dropboxusercontent.com/u/5739741/Images/Prodigies/default-divider.png" width="900"/>
</td></tr><tr><td align="center">
<div id="ShowText2" class="sentient"></div>
</td></tr><tr><td align="center">
<img src="https://dl.dropboxusercontent.com/u/5739741/Images/Prodigies/default-divider.png" width="900"/>
</td></tr></table></center>

</div>

Recommended Answers

All 5 Replies

You've named both arrays the same - 'textarray'. The second instance effectively deletes the first/original array.

Change one of the names in the 'var' declaration, and update the corresponding JavaScript code that refers to the array with the new second name.

So I've updated the "textarray" portions to "textarray2", but one of the arrays still won't show. Did I alter too many elements, perhaps? I basically put a 2 or a 3 behind each of the following: rannum, ShowText, RndText, and now textarray. All of those seemed like arbitrary names that could be adjusted, but let me know if any of those are words needed to make the script actually function. Thank you.

<div>

<!-- Math Conversation -->


<script type="text/javascript">
var textarray2 = [
"The most incomprehensible about Mathematics is that it is comprehensible.",
"Arithmetic is where numbers fly like pigeons in and out of your head. ",
"Black holes result from God dividing the universe by zero. ",
"Geometry is not true, it is advantageous. ",
"I love mathematics because it allows for no hypocrisy and no vagueness.",
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.",
"In mathematics the art of proposing a question must be held of higher value than solving it.",
"In mathematics you don't understand things. You just get used to them.",
"In the binary system we count on our fists instead of on our fingers. ",
"Infinity is a floorless room without walls or ceiling. ",
"Math is radical! Get it?...",
"Mathematics are well and good but nature keeps dragging us around by the nose. ",
"Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.",
"Mathematics is the supreme judge; from its decisions there is no appeal. ",
"Proof is an idol before whom the pure mathematician tortures himself.",
"Pure mathematics is, in its way, the poetry of logical ideas. ",
"Sometimes it is useful to know how large your zero is. ",
"Still more astonishing is that world of rigorous fantasy we call mathematics. ",
"The essence of mathematics is to make complicated things simple. ",
"The highest form of pure thought is in mathematics",
"The human mind has never invented a labor-saving machine equal to algebra. ",
"The pulse of the earth is mathematics",
"There are 10 types of people in this world:  those who understand binary and those who don't. ",
"Trigonometry is a sine of the times.  ",
"Why is it still Train A and Train B? Aren't Planes more modern?",
"I've always loved math for its objectivity. ",
"Chances are, the answer is 5. ",
"So many theorems, such little time. ",
"I'm so smart, I can divide by zero. ",
"You either master math or it masters you. It's unavoidable. ",
"We'll get as far ahead in math as time allows. ",
"If you don’t make mistakes, you’re not working on hard enough problems. And that’s a big mistake.",
"Why do nerds confuse Halloween and Christmas? Because OCT31=DEC25",   // No comma after last entry
];

function RndText2() {
  var rannum2= Math.floor(Math.random()*textarray2.length);
  document.getElementById('ShowText2').innerHTML=textarray2[rannum2];
}
onload = function() { RndText2(); }

</script>

<center>
<table width="950" class="math"><tr><td align="center">
<img src="https://dl.dropboxusercontent.com/u/5739741/Images/Prodigies/default-divider.png" width="900"/>
</td></tr><tr><td align="center">
<div id="ShowText2" class="sentient"></div>
</td></tr><tr><td align="center">
<img src="https://dl.dropboxusercontent.com/u/5739741/Images/Prodigies/default-divider.png" width="900"/>
</td></tr></table></center>
</div>











<div>

<!-- POSTS Conversation -->


<script type="text/javascript">
var textarray3 = [
"The road to success is always under construction.",
"Life is like a ten-speed bike. Most of us have gears we never use.",
"The greatest pleasure in life is doing what people say you cannot do.",
"Disclaimer: I'm not as smart as I think I am.  ",
"I'm not paranoid, but everyone thinks I am...",
"Out of my mind. Back in five minutes. ",
"If you try to fail, and succeed, which have you done? ",
"Why is a wise man and a wise guy opposites? ",
"Why is 'abbreviation' such a long word? ",
"It's so simple to be wise. Just think of something stupid to say and then don't say it. ",
"Shhh... people will believe anything, if you whisper it. ",
"Never test the depth of the water with both feet. ",
"I know what you're thinking... and I'm flattered!",
"pr0digies is definitely the place to be!",
"You again???? What are you up to?",
"Close your eyes, take a deep breath, then read. WAIT, open your eyes first!",
"I know you just love reading these...",
"Sit back, relax, and take in a few more posts.",
"This is one of my favorite posts. Hope you like it.",
"Some interesting stuff, huh?",
"How's your day going? I hope well.",
"I hope you enjoy this post.",
"I hope I'm not bugging you.",
"Thanks for READING MORE. We're totally friends now.",
"It's been nice catching up with you.",
"You're the best!",
"People like you make the world a better place.",
"Nice click!",
"Thanks for being awesome.",
"Wanna hear a joke? [insert arbitrary punchline]",
"You really like reading these, don't you? :-)",
"This program is great, huh?!",
"Hahahahaha!!! Wait, are you laughing too? ",
"Hurry up and read the post! It's a good one.",
"OMG, I can't wait to see what happens next!",
"Well..... Are you gonna comment on this post or not?",
"Have you subscribed yet???? Just enter your email up top.",
"Thanks for keeping track of our day to day.",
"I really appreciate your attention.",
"Be sure to read every post so that you don't miss a thing.",
"Warning: Don't leave the website without saying hi. Politeness counts.",
"Make sure you click on your favorite facet linked below on the right.",
"Caution: Leaving this website may be harmful for your health.",
"Why'd you do that?!",
"So... whatcha readin'?",
"How much wood could a woodchuck chuck if a woodchuck could chuck would?",
"Why do you keep reading these statements I post?",
"The only thing worse than being blind is having sight but no vision.",
"Whether you think you can or think you can’t, you’re right.",
"Life has two rules: #1 Never quit #2 Always remember rule # 1.",
"Even if you’re on the right track, you’ll get run over if you just sit there.",
"Obstacles are those frightful things you see when you take your eyes off your goal.",
"The complexity of simplicity is paradoxical in its hypocrisy. What?!",
"The romanticism of omniscience is sociological in its foresight. What?!",
"The integrity of reciprocity is hardly trivial in its deviousness. What?!",
"I’m not random! I just have lots of thoughts.",
"Love your enemies, it makes them angry",
"In order to succeed, your desire for success should be greater than your fear of failure.",
"The greatest obstacle to discovery is not ignorance; it is the illusion of knowledge.",
"Success consists of going from failure to failure without loss of enthusiasm.",
"Mistakes are the portals of discovery.",
"You can never get enough of what you don’t really need.",
"I don’t know the key to success, but the key to failure is trying to please everybody.",
"I hear: I forget / I see: I remember / I do: I understand",
"Discipline is just choosing between what you want now and what you want most.",
"If opportunity doesn’t knock, build a door.",
"It is our choices, that show what we truly are, far more than our abilities.",
"If you genuinely want something, don’t wait for it – teach yourself to be impatient.",
"A witty saying proves nothing.",
"An ounce of emotion is equal to a ton of facts.",
"No one can make you feel inferior without your consent. "  // No comma after last entry
];

function RndText3() {
  var rannum3= Math.floor(Math.random()*textarray3.length);
  document.getElementById('ShowText3').innerHTML=textarray3[rannum3];
}
onload = function() { RndText3(); }

</script>

<center>
<table width=950 class="posts"><tr><td align="center">
<img src="https://dl.dropboxusercontent.com/u/5739741/Images/Prodigies/default-divider.png" width="900"/>
</td></tr><tr><td align="center">
<div id="ShowText3" class="sentient"></div>
</td></tr><tr><td align="center">
<img src="https://dl.dropboxusercontent.com/u/5739741/Images/Prodigies/default-divider.png" width="900"/>
</td></tr></table></center>

</div>

you're overwritting your onload
you should have one onload function that calls both

BOOM! That was exactly it. THANK YOU!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.