Need a Java script

Spacemail by SpaceshipSpacemail by Spaceship
Watch

smashfactory

Domain GoddessVIP Member
Impact
62
can someone point me in the right direction cuz i have used this before-

i want like 5-10 names to show up in one are like


bobs site
marys site
janes site
joes site

etc...


and each one of those titles is hyperlinked to the site, AND, this is a random group that changes with page reload- so on a reload it would then say:



steves site
mikes site
ricks site
rays site

i found codes that do bits of each but i had this before i just cant remember where, it was javascript code snippit- i was able to just place it right in the body- help!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Here's a PHP snippet I have written, PHP is much more compatible with users than Javascript.

If I did it completely wrong, please tell me so I can correct it.

http://paste.biz/paste-2743.html

PHP:
<?php

/*
 * Script written by Danltn
 * Leave this message intact for use, visitors won't see it, don't worry
 * URL: http://danltn.com
 */

function site($site, $url) 
  {
  // This function turns the provided parameters into a link.
    $link = '<a href="'. $url . '">' . $site . '</a>';
    return $link; 
  } 
 // Set your websites here, remember to increase the number by one each time.

$website[1] = site("Google","http://google.com");
$website[2] = site("MSN","http://msn.com");
$website[3] = site("Yahoo","http://yahoo.com");
$website[4] = site("Ask","http://ask.com");
$website[5] = site("Ebay","http://ebay.com");

$before = ""; // What should go before each link, you could for example use it as a <li> element. I've set it to nothing.
$after = "<br />"; // What should go after, it could be </li> or <br /> for example. I've set it to line break.

$show = 3; // Set the amount of websites to list here

// PHP Magic
$show = floor($show);
if ($show != 1) {
if ($show > count($website)) { $show = count($website); }
$r = array_rand($website, $show);
for ($k=0; $k < $show; $k++)
{
echo $before . $website[$r[$k]] . $after;
} } elseif ($show = 1) { $rand = rand(1, count($website)); echo $website[$rand]; }


?>

If this works like needed, please leave reputation. :)
 
1
•••
i might be hopeless, but i did rep ya for trying to help me!!!!!!!!!!!!!!
 
0
•••
You said you were using SHTML, I've replied explaining how to include things using server side html.

It should all work now, regards. :)
 
Last edited:
0
•••
I am not javascript programmer, but you can try this.

var link = new Array(); // number of links
var randomnumber; // this will be random number


link[0] = "Joe"; // group of ppl
link[1] = "Bob";
link[2] = "Tommy";
link[3] = "John";

randomnumber = Math.random() * 3; // generate random number 0 to 1 * number of links
randomnumber = Math.round(randomnumber); // round this number

document.write(link[randomnumber]); // print it
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back