Web Analytics Made Easy -
StatCounter Random Content Script - CodingForum

Announcement

Collapse
No announcement yet.

Random Content Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Random Content Script

    Alright, I've been trying to get the Random Content Script to work, and I've been having no sucess. My knowledge of Java is limited, so I'm assuming that there is something obvious that I've missed.

    Code:
    <script language="JavaScript">
    <!--
    
    /*
    Random Content Script- By JavaScript Kit([url]http://www.javascriptkit.com[/url]) 
    Over 200+ free JavaScripts here!
    */
    
    function random_content(){
    var mycontent=new Array()
    //specify random content below.
    mycontent[1]='This script made by Daboo.  Visit [url]www.Daboo911.tk[/url]  Script supplied by [url]www.javascriptkit.com[/url]  Enjoy the quotes.'
    mycontent[2]='I got into the gene pool while the lifeguard wasn\'t watching'
    mycontent[3]='The gene pool could use a little chlorine.'
    mycontent[4]='Give me ambiguity or give me something else.'
    mycontent[5]='Friends help you move. Real friends help you move bodies.'
    mycontent[6]='I\'m not a complete idiot, some parts are missing!'
    mycontent[7]='I.R.S.- We\'ve got what it takes to take what you\'ve got!'
    mycontent[8]='All generalizations are false.'
    mycontent[9]='Suicide is man\'s way of telling God, You can\'t fire me - I quit.'
    mycontent[10]='I\'ve had a wonderful time, but this wasn\'t it. - Groucho Marx'
    mycontent[11]='Procrastinate Now!'
    mycontent[12]='I Used to Be Schizophrenic, but We\'re OK Now.'
    mycontent[13]='Just to let you know, don\’t get cancer.'
    mycontent[14]='My train of thought often jumps the tracks to chase after butterflies.'
    mycontent[15]='There are no dumb questions, only inquisitive idiots'
    mycontent[16]='Never play leapfrog with a unicorn'
    mycontent[17]='If all else fails... _PANIC! _I mean, you\'ve already tried everything else, and THAT didn\'t work!'
    mycontent[18]='Pepper spray is great for self defense until you\'re attacked by a cajun.'
    mycontent[19]='I don\’t have a girlfriend.  But I know a girl who would be very mad if she heard me say that.'
    mycontent[20]='I\’ve got people to do and things to see.'
    mycontent[21]='Energizer Bunny Arrested! Charged with battery.'
    mycontent[22]='Hard work has a future payoff.  Laziness pays off now.'
    mycontent[23]='Consciousness: that annoying time between naps.'
    mycontent[24]='Daddy, why doesn\'t this magnet pick up this floppy disk?'
    mycontent[25]='Make it idiot proof and someone will make a better idiot.'
    mycontent[26]='Confucious say rape impossible, woman with skirt up run faster than man with pants down.'
    mycontent[27]='If ignorance is bliss, you must be orgasmic.'
    mycontent[28]='Save the whales, collect the whole set'
    mycontent[29]='Lottery- A tax on people who are bad at math.'
    mycontent[30]='Careful.  We don\'t want to learn from this'
    mycontent[31]='Suicidal twin kills sister by mistake!'
    mycontent[32]='Okay, who put a stop payment on my reality check?'
    mycontent[33]='Don\'t take life too seriously, you\’ll never get out alive.'
    mycontent[34]='I don\'t suffer from insanity.  I enjoy every minute of it.'
    mycontent[35]='I used to have a handle on life, then it broke.'
    mycontent[36]='What\'s yours is mine, and what\'s mine is mine...'
    mycontent[37]='How will you get to work?  _Run _ __Horse _ xNinja Magic'
    mycontent[38]='There are 3 kinds of people in this world: People who can count and people who can\’t.'
    mycontent[39]='I\'m sure that we can settle this like two mature adults, isn\’t' that right Mr. Poopie Pants!'
    mycontent[40]='Mass genocide is one of the most exhausting activities one can engage in...next to soccer. - Dogma'
    mycontent[41]='It\'s medically proven that if your parents don't have kids, neither will you.'
    mycontent[42]='Before you make fun of some, Walk a mile in their shoes... Then when you do make fun of them ... you\'ll be a mile away and have their shoes!!'
    mycontent[43]='Optimism is the key to happiness, but sometimes I lose it between the sofa cushions.'
    mycontent[44]='Don\'t eat cigarettes, Smoke all your greens, Don\'t do school, Stay in drugs'											                                   	-Mr. T
    mycontent[45]='Any day above ground is a good one'
    mycontent[46]='Which is more useful, the Sun or the Moon? The Moon is more useful since it gives us light during the night, when it is dark, whereas the Sun shines only in the daytime, when it is light anyway. _- _George Gamow'
    mycontent[47]='Live in the moment and do what you want, because those that matter don\'t mind and those that mind don\'t matter.'
    mycontent[48]='90% of all statistics are made up'
    mycontent[49]='Statistics show that a big percent of people make the majority, while a small percent of people make the minority.'
    mycontent[50]='Sarcasm? What the hell is that?'
    mycontent[51]='Outside of a dog, a book is man\'s best friend.  And inside of a dog, it\'s too dark to read. - Groucho Marx'
    mycontent[52]=''
    mycontent[53]='Never argue with an idiot.  They will drag you down to their level, then beat you with experience.'
    mycontent[54]='Rehab is for quitters.'
    mycontent[55]='Alcohol and calculus don't mix. Never drink and derive. '
    mycontent[56]='We had creative differences: I was creative and he was different'
    mycontent[57]='Curse your tiny paper hat!!'
    mycontent[58]='What is the point of this? To destroy a man who seeks the truth?  Or to destroy the truth so no man can seek it? – X Files'
    mycontent[59]='Where are you Jebus?? -Homer Simpson '
    mycontent[60]='Life is short and hard, like a bodybuilding midget.'
    mycontent[61]='When Gary told me he had found Jesus, I thought, Yahoo! We\'re rich! But it turned out to be something different.'
    mycontent[62]='If you think about it, dumb people have it made.'
    mycontent[63]='The more you know, the more you know you don\'t know. - Socrates'
    mycontent[64]='The greatest danger may be your stupidity - Chinese fortune cookie.'
    mycontent[65]='Oh!  A sarcasm detector!  That\’s a real great invention.  *BOOM!*'
    mycontent[66]='I\’ve never been a genyuss when it came to spealing.'
    mycontent[67]='Just because I\'m not fond of you currently doesn\'t mean that I want you to keel over in the bathroom in a pool of my own blood and drown in my own vomit.'
    mycontent[68]='It\’s not you – it\’s me.  I don\’t like you.'
    mycontent[69]='I can\'t say I hate life, but it definitely hates me.'
    mycontent[70]='Beer - helping white guys dance since 1842!'
    mycontent[71]='Not only do I speak in redundancies, I find myself saying the same thing more than once . . .'
    mycontent[72]='The only way to gain respect is by doing so good that you can't be ignored.'
    mycontent[73]='Only the dead have seen the end of war. – Plato'
    mycontent[74]='www.UberSecret.tk'
    mycontent[75]='I can picture a perfect world.  A world without hate.  A world without violence.  A world full of love.  And I can picture us attacking that world because they\'d never see it coming.'
    mycontent[76]='I don\'t want to achieve immortality through my work. I want to achieve immortality through not dying. - Woody Allen' 
    mycontent[77]='It\'s so simple to be wise. Just think of something stupid to say and then don\'t say it. - Sam Levenson'
    mycontent[78]='I went on a diet, swore off drinking and heavy eating, and in fourteen days I had lost exactly two weeks. - Joe E. Lewis '
    mycontent[79]='I have enough money to last me the rest of my life - unless I buy something. - Jackie Mason'
    mycontent[80]='With $10,000, We\'d be millionaires, And we could buy lots of things like love and happiness.'
    mycontent[81]='The only quote with free entertainment!<p>*Dancing Squirrel*'
    mycontent[82]='Eagles may soar, but weasels don\'t get sucked into jet engines.'
    mycontent[83]='(Place cool quote here) '
    mycontent[84]='How can you tell what time it is when all those little sticks keep moving around like that?'
    mycontent[85]='EASY TO INSTALL = Difficult to install, but instruction manual has pictures. '
    mycontent[86]='Subtlety is the art of saying what you think and getting out of range before it\'s understood.'
    mycontent[87]=''
    mycontent[88]=''
    mycontent[89]='Speileng es mai best subgeckt.'
    mycontent[90]='It is better to be thought a fool then to open your mouth and remove all doubt - Ben Franklin
    mycontent[91]='Beer is proof God wants us to be happy - Ben Franklin'
    mycontent[92]='Remember Kids Jesus Loves you, but so do child molesters.'
    mycontent[93]='Be nice to everybody, you never know who might be a ninja.'
    mycontent[94]='I love to go to the schoolyard and watch the children jump and scream, but they don\'t know I\'m using blanks.'
    mycontent[95]='The world is made of cheese or the world is not made of cheese.  Scientists have proven it\'s not made of cheese.  Conclusion: it\'s made of cheese.'
    mycontent[96]='I never knew anyone who went crazy before-except my invisible friend Col. Spots'
    mycontent[97]=''
    mycontent[98]='Beware of Thomas,<br>The train with the human face,<br>He\'s not in God\'s plan.'
    mycontent[99]=''
    mycontent[100]='In case of emergency, break glass. Scream. Bleed to death'
    mycontent[101]='When I die, I want to go like my grandfather did, peacefully in his sleep. Not yelling and screaming like all the passengers in his car'
    mycontent[102]='Just because you\'re stupid doesn\'t mean I'm lying'
    mycontent[103]='Now I know I\'m not normally a praying man, but if you\'re up there, please save me, Superman!'
    mycontent[104]='Don\'t sweat the petty things, and don\'t pet the sweaty things'
    mycontent[105]='I\'m not a follower... I\'m a leader with the same idea'
    mycontent[106]='Alcohol doesn\'t solve any problems, but then again, neither does milk'
    mycontent[107]='It\'s hard to be religious when certain people are never incinerated by bolts of lightning'
    mycontent[108]='If most people said what\'s on their minds, they\'d be speechless'
    mycontent[109]='The surest sign that intelligent life exists elsewhere in the universe is that it has never tried to contact us'
    mycontent[110]='Duct tape is like the Force. It has a light side, a dark side, and it holds the universe together'
    mycontent[111]='It\’s always darkest before dawn. So if you\'re going to steal the neighbor\'s newspaper, that\'s the time to do it'
    mycontent[112]='Always remember you\'re unique, just like everyone else'
    mycontent[113]='It may be that your sole purpose in life is simply to serve as a warning to others'
    mycontent[114]='Never underestimate the power of stupid people in large groups'
    mycontent[115]='If you drink, don\'t park. Accidents cause people'
    mycontent[116]='If at first you don\'t succeed, skydiving is not for you'
    mycontent[117]='I didn\'t say it was your fault. I said I was going to blame you'
    mycontent[118]='If Barbie is so popular, why do you have to buy her friends?'
    mycontent[119]='How many of you believe in telekinesis? Raise my hands'
    mycontent[120]='Analyzing humor is like dissecting a frog: Nobody really enjoys it and the frog generally dies as a result'
    mycontent[121]='A cynic is a person searching for an honest man, with a stolen lantern'
    mycontent[122]='Man will occasionally stumble over the truth, but most of the time he will pick himself up and continue on'
    mycontent[123]='Enjoy every minute. There\'s plenty of time to be dead'
    mycontent[124]='Life is too important to take seriously'
    mycontent[125]='If you love something, set if free. If it doesn\'t return, hunt it down and kill it'
    mycontent[126]='Profanity is a crutch for the inarticulate mother****er'
    mycontent[127]='A few words placed between quotation marks are not always life altering.'
    mycontent[128]='When Mary had a little lamb, the doctor was suprised, but when Old MacDonald had a FARM, he very nearly had a heart attack!'
    mycontent[129]='Never, ever make absolute, unconditional statements'
    mycontent[130]='If you lend someone $20, and never see that person again, it was probably worth it'
    mycontent[131]='When you get upset, remember it takes 42 muscles to frown, and only 4 to extend your middle finger'
    mycontent[132]='If you try and don\'t succeed, cheat. Repeat until caught. Then lie'
    mycontent[133]='The meaning of life is to give life meaning'
    mycontent[134]='That place is so crowded, nobody goes there anymore'
    mycontent[135]='I\'ve worn contact lenses so long I can put them in with my eyes closed'
    mycontent[136]='How to become immortal: Read this tomorrow and follow its advice'
    mycontent[137]='I\'d insult you, but you\'re not bright enough to notice'
    mycontent[138]='Don\’t steal, the government hates competition'
    mycontent[139]='I\'m a nobody, nobody is perfect, therefore I\'m perfect'
    mycontent[140]='I have the heart of a child. I keep it in a jar'
    mycontent[141]='Want to add a quote to this list?  E-mail me: [email][email protected][/email]'
    mycontent[142]='Reality is an illusion created by alcoholic deficiency'
    mycontent[143]='When everything comes your way, you\'re in the wrong lane'
    mycontent[144]='Smile, it makes people wonder what you\'re thinking'
    mycontent[145]='When it comes to thought some people stop at nothing'
    mycontent[146]='Somewhere on this globe, every ten seconds, there is a woman giving birth to a child. She must be found and stopped'
    mycontent[147]='The Two Rules of Success- 1. Don\'t tell everything you know'
    mycontent[148]='You know you\'re in trouble when you start planning parcrastination, and then wait till later to do it'
    mycontent[149]='If life gives you lemons, take them and run! You just got yourself some free lemons!'
    mycontent[150]='Friends who think they\'re perfect are very annoying to those of us who really are'
    mycontent[151]='What is love?<br>What is this longing in our hearts for togetherness?<br>Is it not the sweetest flower?<br>Does not this flower of love have the fragrant aroma of fine fine diamonds?<br>Does not the wind love the dirt?<br>Is not love not unlike the unlikely not it is unlikened to?<br>Are you with someone tonight?<br>Do not question your love<br>Take your lover by the hand<br>Release the power within yourself<br>You heard me, release the power<br>Tame the wild cosmos with a whisper<br>Conquer heaven with one intimate caress<br>That\'s right, don\'t be shy<br>Whip out everything you got,<br>and do it in da\' butt.<br>by Leon Phelps The Lady\’s Man'
    mycontent[152]='Television is a medium- so called because it is neither rare nor well-done'
    mycontent[153]='Confuscious say, man standing on toilet is high on pot.'
    mycontent[154]='Man with hole in pocket feel cocky all day.'
    mycontent[155]='Guns don\'t kill people, angry minorities do.'
    mycontent[156]='You\'re not drunk if you can lie on the floor without holding on.'
    mycontent[157]='If only I had a little humility, I\'d be perfect.'
    
    var ry=Math.floor(Math.random()*mycontent.length)
    if (ry==0)
    ry=1
    document.write(mycontent[ry])
    }
    random_content()
    //-->
    </script>
    Any help you can give me would be greatly appreciated.
    Thank you,
    John
    Last edited by daboo; Mar 9, 2004, 08:55 PM.

  • #2
    Any single quotes you use in your content must be escaped with a backslash (\) since the string is delimitted with single quotes.

    eg:
    mycontent[9]='Suicide is man\'s way of telling God, You can\'t fire me - I quit.'


    .....Willy

    BTW: In the future please use CODE tags when posting code so that it is easier to read and copy.

    Comment


    • #3
      Thanks willy, changes made, but it is still not working for some reason. I've updated the script above, any ideas what is wrong?

      Comment


      • #4
        You didn't get them all.

        eg:
        mycontent[12]='I Used to Be Schizophrenic, but We're OK Now.'

        ....Willy

        Comment


        • #5
          If you only want to show a static code when the page is loaded you should really use a server language so the user don't download hundreds of useless never shown quotes.

          Comment


          • #6
            You didn't get them all.

            eg:
            mycontent[12]='I Used to Be Schizophrenic, but We're OK Now.'

            ....Willy
            I actually have gone through it twice, and though I'm not sure that I've gotten them all, I am sure that I've got that one.
            When I went to update the script above (which has the We\'re), I pasted it into my message (and it showed as We\'re), but it didn't change when I submitted it.
            Not sure why.
            I'll keep screwing around with it, and I'll check the script again.

            If you only want to show a static code when the page is loaded you should really use a server language so the user don't download hundreds of useless never shown quotes.
            I know that is what I should do, but I don't have any idea of what I'm doing with those languages. I have some faint idea with Java. If you know of any sites like JavaScriptKit for PHP or whatever, let me know.

            Hope some of that made sense.

            Comment


            • #7
              You've missed a whole bunch of them!
              eg: array #'s 2,6,7,9, 12
              Just to name a few.

              Just one will break the script.
              Try turning on Script Debugging so you can see the line numbers the alerts are thrown for.

              .....Willy

              Comment


              • #8
                Right, I know that in the post there are missing backslashes, but in my script, there are not.
                For some reason, when I edit my first post, it does not change.

                I just tried pasting it into this post, but when I preview it, it is missing backslashes again.
                I have no idea why this is happening, but I think it may be the code tag. I will edit it and see if it works better in the quote tag (I know it is harder to read, but theres no point in posting the script that I'm not using).

                EDIT:
                When changed to the quote tag it still won't add the backslashes.
                Oh well.
                Thank you all for you're help,
                I think I'm on this one alone now.
                Last edited by daboo; Mar 9, 2004, 08:57 PM.

                Comment


                • #9
                  Try attaching a .txt file to your post.

                  .....Willy

                  Comment


                  • #10
                    Here it is
                    Attached Files

                    Comment


                    • #11
                      All that is wrong is that you are missing a single quote at the end of mycontent[90] (line 100)

                      eg:
                      mycontent[90]='It is better to be thought a fool then to open your mouth and remove all doubt - Ben Franklin'

                      Fix that and you will be good to go.

                      .....Willy

                      Comment


                      • #12
                        Awesome, you've been a great help willy.
                        Thank you so much!

                        Comment

                        Working...
                        X