-
Random Image Load
Hi, Can you help at all please.
I am looking for a script whereby a new client testimonial will load into the page each time the page is opened.
It doesn't need to tween between other testimonials it just m=needs to load a new random message each time.
Many thanks in advance.
-
PHP:
Code:
<?php
$message = array("Welcome to my site!", "Hello World.", "Wassup?");
echo $message[rand(0, count($message)-1)];
?>
JS:
Code:
<script type="text/javascript">
var messages = ["Welcome to my site!", "Hello World.", "Wassup?"];
alert(messages[Math.floor(Math.random()*messages.length)]);
</script>
-
Thanks, but not quite what I had in mind.
The random message will actually be within the website screen itslef and will be a testimonial. Probably as a image.
-
So use the php one. Or does your server not support PHP?