Results 1 to 4 of 4

Thread: From the deepest pit of Newbie-ism.

  1. #1
    Join Date
    Sep 2004
    Location
    Tacoma, WA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post From the deepest pit of Newbie-ism.

    I just started learning javascript and I got a good idea for a funny joke , it's the most "accurate" totaly random weather predictor. Yet for some reason I can't get it to stink'n work ... AHH! ...Anyway I need some help. I attached the code. Any ideas why it's not working? As soon as someone who knows javascript looks at this, they're probaly going to think "What an idiot! The problem is so simple!", well, I'm a newbie, if you know what the means. I've tried outsourcing the "function predict()" and ran it fine using cscript, so I don't think that particular thing has a problem, though I can't check all of it because cmd doesn't recognise "document.write()".

    Ps Some people told me to put those backslashes there.

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Invalid syntax?

    Hi,

    I think you've got your languages very confused!
    Javascript isn't cscript, and the command prompt (cmd) doesn't recognise javascript at all! Still, no worries, its nice to see someone trying to make their own scripts.

    Also, don't leave your email address in scripts, it'll get harvested and spammed by computers designed to do so. Use this syntax instead: chronos0 [at] softhome [dot] net

    Here's one I made earlier; use this script instead...
    I might be nice to you and recreate your weather generator later

    Edit: Because I'm so nice , your finished script is attached on the post below this one.


    Code:
    <body>
    
    <script language="javascript">
    
    function random_text()
    {};
    var random_text = new random_text();
    // Leave as 0.
    var number = 0;
    random_text[number++] = "Text 1"
    random_text[number++] = "Text 2"
    random_text[number++] = "Text 3"
    random_text[number++] = "Text 4"
    random_text[number++] = "Text 5"
    random_text[number++] = "Text 6"
    random_text[number++] = "Text 7"
    random_text[number++] = "Text 8"
    random_text[number++] = "Text 9"
    random_text[number++] = "Text 10"
    // Add more as necessary
    var random_number = Math.floor(Math.random() * number);
    document.write(random_text[random_number]);
    </script>
    <br><br>
    Click <a href="javascript:history.go(0);">refresh</a> to see more random text.
    </body>
    Just replace the text and you're laughing.

    Hope this helps!
    cr3ative
    Last edited by cr3ative; 09-02-2004 at 05:37 PM. Reason: Added script
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Your weather generator

    After much tweaking and poking, here is your weather generator, fully based on your ideas.

    Let us know when you have your website running!
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  4. #4
    Join Date
    Sep 2004
    Location
    Tacoma, WA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much, I don't know why it didn't work, It only showed HTML I put in the <body> before the script, I tried switch and if's using just plain math.random(), <'s, and >'s... Anyway, I'm pretty sure cscript can understand, because if you try to enter a file with an unknown file extension it has an error, <file>.js didn't get this, and it even listed an error I didn't notice. It doesn't, however, understand commands like document.<blablabla>, being cmd.
    Last edited by Chronos; 09-03-2004 at 03:17 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •