Results 1 to 2 of 2
  1. #1
    bzbzb1 is offline Member
    Join Date
    May 2012
    Rep Power

    Default Need help adding a "randomizer" to this code.

    Hi Everyone,

    I'm using the code below to rotate between some testimonials for my website and I realized that it would be better to make the order random rather than always cycling the same each time to be sure the later ones get equal visibility on the home page. I found the code and tweaked it as I needed but I'm not familiar enough with java to know how to add a randomizing component. I'd appreciate any help offered since I hope it's straight forward enough for someone who knows the language well.

    Thanks a lot!

    var quote=new Array();
    quote[0]="An essential tool in preparation for any show. Valuable time is saved, refining vocals much earlier in the process.";
    quote[1]="Invaluable for learning vocal lines! A brilliantly simple and easy to use interface that saved me hours of time.";
    quote[2]="MixMyPart saved us almost a week of rehersal time. A brilliant invention. Singers come in less nervous and more focused.";
    <!-- quote[3]="An invaluble tool for learning vocal lines! Brilliantly simple and easy to use interface that saved me hours of time.";

    var quoteperson=new Array();
    quoteperson[0]="Bob Foster, <font color=\"ffffff\">Music Director</font>";
    quoteperson[1]="Liam Tobin, <font color=\"ffffff\">Actor</font>";
    quoteperson[2]="Shawn Wright, <font color=\"ffffff\">Actor</font>";
    <!-- quoteperson[3]="Liam Tobin, <a href=\"website.html\" target=\"_blank\"></a>";

    var speed=9000;
    var q=0;

    function showQuote() {
    document.getElementById("tst").innerHTML="&ldquo;" +quote[q]+"&rdquo;";
    document.getElementById("tstperson").innerHTML=quo teperson[q];
    if(q==quote.length) {

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Need help adding a "randomizer" to this code.

    That's not Java. Find a JavaScript forum. This isn't one.


    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 5
    Last Post: 04-29-2012, 07:18 AM
  2. Program skips "If" code and goes straight to "Else"
    By Logik22 in forum New To Java
    Replies: 12
    Last Post: 01-21-2012, 05:40 PM
  3. Adding "Choose File" button to applet
    By mju4t in forum Java Applets
    Replies: 1
    Last Post: 09-17-2009, 08:11 AM
  4. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

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