Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Random content coding-confuzzled

    ah hey hey.
    I have been assigned the great duty of making a form website, but am having trouble with a random content script, can anyone point out what is wrong with this:
    <script language="JavaScript">
    <!--


    function random_content(){
    var mycontent=new Array()
    //specify random content below.
    mycontent[1]='<b><img src="hardial.jpg" width="150" height="150"> <br> Name: Hardial Kalsi <br>Occupation:<br>Often Heard Saying:blablabla</b>'
    mycontent[2]='<b><img src="scully.jpg" width="150" height="150"> <br> Name: Niall Scully<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[3]='<b><img src="umar.jpg" width="150" height="150"> <br> Name: Umar Khan<br>Occupation:<br>Often Heard Saying:blablabla</b>'
    mycontent[4]='<b><img src="joshj.jpg" width="150" height="150"> <br> Name:Joshua Johnson<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[5]='<b><img src="shuaib.jpg" width="150" height="150"> <br> Name: Shuaib Ahmed<br>Occupation:blablabla<br>Often Heard Saying:</b>'
    mycontent[6]='<b><img src="amir.jpg" width="150" height="150"> <br> Name: Amir Hussain<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[7]='<b><img src="fender.jpg" width="150" height="150"> <br> Name:Thomas Fender<br>Occupation:<br>Often Heard Saying:blablabla</b>'
    mycontent[8]='<b><img src="watts.jpg" width="150" height="150"> <br> Name: ThomasWatts<br>Occupation:Clever<br>Often Heard Saying:</b>'
    mycontent[9]='<b><img src="josha.jpg" width="150" height="150"> <br> Name:Joshua Ainsworth<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[10]='<b><img src="jim.jpg" width="150" height="150"> <br> Name:James Edwards<br>Occupation:Self Hating ginger<br>Often Heard Saying:</b>'
    mycontent[11]='<b><img src="russel.jpg" width="150" height="150"> <br> Name:Russel Cafferty<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[12]='<b><img src="tipper.jpg" width="150" height="150"> <br> Name:James Tipper<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[13]='<b><img src="matt.jpg" width="150" height="150"> <br> Name:Matthew Straughn<br>Occupation:<br>Often Heard Saying:blablabla</b>'
    mycontent[14]='<b><img src="luke.jpg" width="150" height="150"> <br> Name: Luke Cragg<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[15]='<b><img src="askey.jpg" width="150" height="150"> <br> Name:Thomas Askey<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[16]='<b><img src="loren.jpg" width="150" height="150"> <br> Name: Loren Oakley<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[17]='<b><img src="joshscanedo.jpg" width="150" height="150"> <br> Name: Josh Seaton -on the left<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[18]='<b><img src="ng.jpg"width="150" height="150"> <br> Name: Jeffrey Ng<br>Occupation: <br>Often Heard Saying:</b>'



    Many thanks, Caecilius

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What trouble are you having? It looks like you did not post all of the script. Can you post the entire script r a link to the page. thankyou.

  • #3
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.anthologyofhatred.co.uk/index1.html

    the content is just not appearing.
    Ty for any help RC

  • #4
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    bump. anyone?

  • #5
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Watch your punctuation.

    Your single quotes used within the mycontent
    array need to be escaped with a backslash \

    <script language="JavaScript">
    <!--

    /*
    Random Content Script- By JavaScript Kit(http://www.javascriptkit.com)
    Over 200+ free JavaScripts here!
    */

    function random_content(){
    var mycontent=new Array()
    //specify random content below.
    mycontent[1]='<b><img src="hardial.jpg" width="150" height="150"> <br> Name: Hardial Kalsi <br>Occupation:Tall<br>Often Heard Saying:Anyone heard of that band, [underground band name here]</b>'
    mycontent[2]='<b><img src="scully.jpg" width="150" height="150"> <br> Name: Niall Scully<br>Occupation:Irish<br>Often Heard Saying:That\\'s crap</b>'
    mycontent[3]='<b><img src="umar.jpg" width="150" height="150"> <br> Name: Umar Khan<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[4]='<b><img src="joshj.jpg" width="150" height="150"> <br> Name:Joshua Johnson<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[5]='<b><img src="shuaib.jpg" width="150" height="150"> <br> Name: Shuaib Ahmed<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[6]='<b><img src="amir.jpg" width="150" height="150"> <br> Name: Amir Hussain<br>Occupation:Liker of Fender<br>Often Heard Saying:</b>'
    mycontent[7]='<b><img src="fender.jpg" width="150" height="150"> <br> Name:Thomas Fender<br>Occupation:Fending<br>Often Heard Saying:naah man thats slack</b>'
    mycontent[8]='<b><img src="watts.jpg" width="150" height="150"> <br> Name: ThomasWatts<br>Occupation:Clever<br>Often Heard Saying:</b>'
    mycontent[9]='<b><img src="josha.jpg" width="150" height="150"> <br> Name:Joshua Ainsworth<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[10]='<b><img src="jim.jpg" width="150" height="150"> <br> Name:James Edwards<br>Occupation:Self Hating ginger<br>Often Heard Saying:</b>'
    mycontent[11]='<b><img src="russel.jpg" width="150" height="150"> <br> Name:Russel Cafferty<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[12]='<b><img src="tipper.jpg" width="150" height="150"> <br> Name:James Tipper<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[13]='<b><img src="matt.jpg" width="150" height="150"> <br> Name:Matthew Straughn<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[14]='<b><img src="luke.jpg" width="150" height="150"> <br> Name: Luke Cragg<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[15]='<b><img src="askey.jpg" width="150" height="150"> <br> Name:Thomas Askey<br>Occupation:<br>Often Heard Saying:</b>'
    mycontent[16]='<b><img src="loren.jpg" width="150" height="150"> <br> Name: Loren Oakley<br>Occupation:New<br>Often Heard Saying:Where is room x?</b>'
    mycontent[17]='<b><img src="joshscanedo.jpg" width="150" height="150"> <br> Name: Josh Seaton -on the left<br>Occupation:<br>Often Heard Saying:Gil\\'Tay! (agility)</b>'
    mycontent[18]='<b><img src="ng.jpg"width="150" height="150"> <br> Name: Jeffrey Ng<br>Occupation: Short<br>Often Heard Saying:Lay Say Poo Kai</b>'

    var ry=Math.floor(Math.random()*mycontent.length)
    if (ry==0)
    ry=1
    document.write(mycontent[ry])
    }
    random_content()
    //-->
    </script>

    .....Willy

  • #6
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its about time superman stood down on his post, willy is my new hero


  •  

    Posting Permissions

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