main
side
curve
  1. In Memory of LAJ_FETT: Please share your remembrances and condolences HERE

Script flow

Discussion in 'Archive: Fan Sites' started by Raef_Wolfe, Aug 8, 2003.

Thread Status:
Not open for further replies.
  1. Raef_Wolfe

    Raef_Wolfe Jedi Padawan star 4

    Registered:
    Jul 12, 2003
    http://clavius.hackensackhigh.org/~cc/mp3.html


    Check out the grey area at the bottom of the page where the message flows. How can I do that? I tried 'view: source' but it didn't look right.
     
  2. Grimby

    Grimby Technical Consultant & Former Head Admin star 7 Staff Member Administrator

    Registered:
    Apr 22, 2000
    raef, that's done using a clever piece of javascript coding. look at the source of that page again and you'll find the code all the way at the bottom. ;)
     
  3. Raef_Wolfe

    Raef_Wolfe Jedi Padawan star 4

    Registered:
    Jul 12, 2003
    I looked, but it's all jibberish and hocus pocus. What am I SUPPOSED to be seeing?
     
  4. Ardens_Furore

    Ardens_Furore Jedi Padawan star 4

    Registered:
    May 14, 2001
    You're supposed to be seeing the code. Kind of like the Matrix. :)

    Actually, here's how it works. There's a few messages stored as variables. The function is set to call itself on a certain time interval. Every time it does, it causes the message to scroll over by one letter. Of course, this is a very sketchy description, as I really don't know JavaScript. I've seen variations of this scroller since 1996 (or whenever Netscape 2.0 came out). The first one I saw also used the same variable names, like "seed". So all of these were probably somehow based on the first version.
     
  5. Grimby

    Grimby Technical Consultant & Former Head Admin star 7 Staff Member Administrator

    Registered:
    Apr 22, 2000
    the javascript code is everything in that source code at the end between the <script> tags. the actual command executing the script is this code way at the bottom:
    <!--
    infoscroll(100,1)
    // -->
     
  6. Raef_Wolfe

    Raef_Wolfe Jedi Padawan star 4

    Registered:
    Jul 12, 2003
    Ardens:

    I knw what I'm supposed to be seeing, the code, god knows I used HTML from scratch enough, I just didn't know the javascript code :)

    Grimby:

    Thanks a bunch!

    EDit: It's not working. No matter what I do, I can't get the message to flow.

    Here's my code:

    <script laguage-JAVASCRIPT>
    <!-- infoscroll(100,1) vartext1: "Message" // --> </script>

    What a I doing wrong?
     
  7. malducin

    malducin Jedi Padawan star 4

    Registered:
    Oct 23, 2001
    Well for starters, are you including all the code? As you can clearly see the last bit uses a function called infoscroll, which is defined in the previous script tags. You first have to define infoscroll. Here is the entire bit:


    <script LANGUAGE="JavaScript">
    function infoscroll(seed,looped)
    {
    var text0 = " ";
    var text1 = "You wanted them now you have them. Episode I mp3's. Download them ASAP.";
    var text2 = "Star Wars: Episode 1 is out in movie theaters NOW! Go see it. Now. Right now. Seen it already? See it again!";
    var text3 = "3 Hot Games from Lucasarts are out, X-Wing Alliance, Star Wars Episode I, and Star Wars Racer. Live the legend!";
    var text4 = "E-mail me: master_yoda10@hotmail.com Your comments, suggestions, complaints, and questions are welcome.";
    var text5 = "Guess what guys? I have a news section! I know you're just dying to see it! Go for it! What do you have to lose? Just your sanity and your soul..."
    var msg=text1+text0+text5+text0+text2+text0+text3+text0+text4;
    var putout = " ";
    var c = 1;

    if (looped > 10)
    { window.status="The Force will be with you, always."; }
    else if (seed > 100)
    {
    seed--;
    var cmd="infoscroll(" + seed + "," + looped + ")";
    timerTwo=window.setTimeout(cmd,100);
    }
    else if (seed <= 100 && seed > 0)
    {
    for (c=0 ; c < seed ; c++)
    { putout+=" "; }
    putout+=msg.substring(0,100-seed);
    seed--;
    var cmd="infoscroll(" + seed + "," + looped + ")";
    window.status=putout;
    timerTwo=window.setTimeout(cmd,100);
    }
    else if (seed <= 0)
    {
    if (-seed < msg.length)
    {
    putout+=msg.substring(-seed,msg.length);
    seed--;
    var cmd="infoscroll(" + seed + "," + looped + ")";
    window.status=putout;
    timerTwo=window.setTimeout(cmd,100); // 100
    }
    else
    {
    window.status=" ";
    looped += 1;
    var cmd = "infoscroll(100," + looped + ")";
    timerTwo=window.setTimeout(cmd,75); // 75
    }
    }
    }
    // -->

    <!--
    infoscroll(100,1)
    // -->
    </SCRIPT>


    As you can see the function is defined and then immediately used. You just chane the text content by redifining the tet variables at the top.
     
  8. Grimby

    Grimby Technical Consultant & Former Head Admin star 7 Staff Member Administrator

    Registered:
    Apr 22, 2000
    ...yeah, do that...
     
  9. Raef_Wolfe

    Raef_Wolfe Jedi Padawan star 4

    Registered:
    Jul 12, 2003
    So I have to copy and paste all of that for my one message?
     
  10. Grimby

    Grimby Technical Consultant & Former Head Admin star 7 Staff Member Administrator

    Registered:
    Apr 22, 2000
    yep. kinda wierd, but it makes sense if you understand programming... :p
     
  11. Lobot_Omy

    Lobot_Omy Moderator Emeritus star 6 VIP - Former Mod/RSA

    Registered:
    Jul 9, 2001
    I think you can find the code to do that in any JavaScript guide.
     
  12. Ardens_Furore

    Ardens_Furore Jedi Padawan star 4

    Registered:
    May 14, 2001
    I wouldn't copy it verbatim without giving credit to the original author.
     
Thread Status:
Not open for further replies.