[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JavaScript and Reload



How come JavaScript acts weird when I press the reload button on Netscape?
So I have a dorky Javascript which puts a new message into the page everytime
it's loaded.

<head>
<script language="JavaScript">

<!-- This sucks. Hide it
function prisrand() {
var ack = Math.round(100 * Math.random());

if (ack < 10) {
   prison = "Have a Nice Day." + "<BR>" + "Feel Free."; }
else if (ack < 20) {
   prison = "Questions are a burden to others." + "<BR>" + "Answers a prison for oneself."; }
else if (ack < 30) {
   prison = "I am Not a Number." + "<BR>" + "I am a Free Man."; }
else if (ack < 40) {
   prison = "A Still Tongue Makes a Happy Life."; }
else if (ack < 50) {
   prison = "We're Democratic." + "<BR>" + "In some ways."; }
else if (ack < 60) {
   prison = "Never Trust a Woman." + "<BR>" + "Even the Four-Legged Variety."; }
else if (ack < 70) {
   prison = "Six of One." + "<BR>" + "A Half Dozen of the Other."; }
else if (ack < 80) {
   prison = "Who is Number 1?" + "<BR>" + "You are Number 6."; }
else {
   prison = "That would be telling."; }

document.write(prison);
}
// Eat me -->
</script>
</head>

So when I reload the page, Netscape refuses to print out any text or images
after the function call.

But, if I specifically type in the page URL through either a link or in the
URL Location bar, the page loads just fine. WHat is reload actually doing
to cause this bug (or is it just my crappy code?). Doesn't reload just
recall the URL or is there some unusual things going on behind the
scenes? Thank you for any assistance.


                                    Sincerely,


                                    Jirawat Uttayaya a.k.a. Peaking Duck

--------------------------------------------------------------------
This message came from the mailing list javascript. For help using the
mailing list software, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.