PDA

View Full Version : Tesimonial Script written in Java



abound
11th Aug 2005, 08:44 PM
Following is a script I wrote in Java for posting random testimonials on your website. You can either embed the script in your template or text element, or you can host the script and refer to it remotely. If you don't know how to host java on your SOL website, you can read about it here: http://www.onlinemerchantforum.com/forum/viewtopic.php?t=20

Here's the script:


function printPraise()
{
var numPraises = 5
var ran_number=Math.round(Math.random()*(numPraises-1))
var praises=new Array(numPraises)

praises[0]=""(1)I love your products!!"

-- R.L."
praises[1]=""(2)I love your products!!"

-- M.M."
praises[2]=""(3)I love your products!!"

-- J.M."
praises[3]=""(4)I love your products!!"

-- M.P."
praises[4]=""(5)I love your products!!"

-- T.C."

document.write("<table border=1 cellspacing=1 bordercolor=#111111 width=90%><tr><td width=100%>")
document.write("<center><FONT lang=0 face=Arial size=1 FAMILY=SANSSERIF>")
document.write(praises[ran_number])
document.write("</font>")
document.write("</td></tr></table></center>
")

}

printPraise()

The way the script works is it has a list of quotes. It then chooses one at random, and prints it while your webpage is being loaded. To customize the script, do the following:

1. Replace the words "(?)I love your products!!" with your testimonial.
2. Replace the letters after the "--" with your customer's initials.
3. If you have more than 5 testimonials, just keep adding more lines. Make sure to increment the number in the brackets. (Make sure the first one is always number zero!)
4. When you have all your testimonials, set numPraises to the number of testimonials (this will be the highest numbered testimonial plus 1, because we start at zero).
That's it!

Some guidelines to follow:
1. &quot is how you include a double quote in your testimonial. Notice I start and end each quotation with &quot.
2. If your quotation has a " in it, the script won't work. Either delete the ", or you can use ' or &quot in its place.
3. Because it is such an easy error to make, and most of you are amateurs at programming, I recommend doing a search on " to make sure that no " characters got accidentally embedded in a testimonial. If you miss just one, the script won't run!

Notice I embed some html into the testimonial--> the
. This means I could also embed hyperlinks in there, too!

ExcaliburBrothers
15th Mar 2006, 09:51 AM
3. Because it is such an easy error to make, and most of you are amateurs at programming, I recommend doing a search on " to make sure that no " characters got accidentally embedded in a testimonial. If you miss just one, the script won't run!

I almost PM'd you because I had updated my testimonials and couldn't figure out why they didn't work. Decided to read the instructions one more time (even though I didn't change the "code" just added testimonials) sure enough when I copied what someone had wrote there were double quotes " in their comments

Now it's working again.

Lawrence

abound
19th Mar 2006, 08:34 PM
:D

Christine
19th Mar 2006, 11:41 PM
I also came acros that problem when installing the box with text on the linking to us page the description had an " in it. Couldn't figure out for awhile what was wrong.