[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: JavaScript and Reload
The script works for me, though I had to put in an explicit call to
prisrand(), which you don't show (don't know if
you have one in your script or not, but this may be the source of the problem).
A bigger problem, though, is your use of random, which is only currently
supported on the Unix platform. Netscape 2.0
running under Windows or Mac will gag on Math.random.
You also forgot "Be seeing you," but that's another matter... <g>
-- Gordon
At 11:00 AM 2/22/96 -0500, you wrote:
>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.
--------------------------------------------------------------------
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'.