Random Page Link?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a poetry site with about 100 pages. Can I put a random link on the
home page that will send visitors to a random page? As always, thanks a heap,
Graeme
 
Do a search on Google for "Random Link JavaScript". (without "")

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.

-----Original Message-----
From: wewak11 [mailto:[email protected]]
Posted At: 17. juni 2005 06:21
Posted To: microsoft.public.frontpage.client
Conversation: Random Page Link?
Subject: Random Page Link?


I have a poetry site with about 100 pages. Can I put a random link on
the home page that will send visitors to a random page? As always,
thanks a heap, Graeme
 
Hi wewak11
(BTW, Are you from PNG?)

You could try this code
<html>
<head>
<script type="text/javascript">
function select()
{
no=Math.round(Math.random()*3)
var randref
= (no == 1) ? "http://members.ozemail.com.au/~fred.blow/"
: (no == 2) ? "http://members.ozemail.com.au/~joe.bloggs/"
: "http://google.com"
document.getElementById('randlnk').innerHTML =
'<a href="' + randref + '">Random Link</a>'
}
</script>
</head>

<body onload="select()">
<span id="randlnk">link goes here</span>
</body>
</html>

Change
no=Math.round(Math.random()*3)
to
no=Math.round(Math.random()*100) or whatever the upper count is.

Add extra elements after (no ==2)
: (no == 3) ? "http://........./"
: (no == 4) ? "http:/........../"

This will place a hyperlink named Random Link on your page, and it will link
randomly

There may be a neater way to do it , such as placing the <a href ..> in the
body of the code and amending its attributes with JS. However, I tested my
code with genuine links and it worked.
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au
I have a poetry site with about 100 pages. Can I put a random link on
the home page that will send visitors to a random page? As always,
thanks a heap, Graeme


I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html
 
Hi, wewak11,

I wonder whether our US friends would know why I asked about PNG :-)))

I would be interested to see your site sometime
 
I like to Wewaks from time to time.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
Wondering, but afraid to ask :-)


| Hi, wewak11,
|
| I wonder whether our US friends would know why I asked about PNG :-)))
|
| I would be interested to see your site sometime
| --
| Cheers,
| Trevor L.
| Website: http://tandcl.homemail.com.au
|
| wewak11 wrote:
| > Thanks a heap. I lived in Wewak for 6 years in the 80's
| >
| > "Trevor L." wrote:
| >
| >> Hi wewak11
| >> (BTW, Are you from PNG?)
| >>
| >> You could try this code
| >> <html>
| >> <head>
| >> <script type="text/javascript">
| >> function select()
| >> {
| >> no=Math.round(Math.random()*3)
| >> var randref
| >> = (no == 1) ? "http://members.ozemail.com.au/~fred.blow/"
| >> : (no == 2) ? "http://members.ozemail.com.au/~joe.bloggs/"
| >> : "http://google.com"
| >> document.getElementById('randlnk').innerHTML =
| >> '<a href="' + randref + '">Random Link</a>'
| >> }
| >> </script>
| >> </head>
| >>
| >> <body onload="select()">
| >> <span id="randlnk">link goes here</span>
| >> </body>
| >> </html>
| >>
| >> Change
| >> no=Math.round(Math.random()*3)
| >> to
| >> no=Math.round(Math.random()*100) or whatever the upper count is.
| >>
| >> Add extra elements after (no ==2)
| >> : (no == 3) ? "http://........./"
| >> : (no == 4) ? "http:/........../"
| >>
| >> This will place a hyperlink named Random Link on your page, and it
| >> will link randomly
| >>
| >> There may be a neater way to do it , such as placing the <a href ...>
| >> in the body of the code and amending its attributes with JS.
| >> However, I tested my code with genuine links and it worked.
| >> --
| >> Cheers,
| >> Trevor L.
| >> Website: http://tandcl.homemail.com.au
| >>
| >> wewak11 wrote:
| >>> I have a poetry site with about 100 pages. Can I put a random link
| >>> on the home page that will send visitors to a random page? As
| >>> always, thanks a heap, Graeme
| >>
| >>
| >> I choose Polesoft Lockspam to fight spam, and you?
| >> http://www.polesoft.com/refer.html
|
|
 
Wewak is a place in PNG (Papua New Guinea), a country that neighbours
Australia on our north
 
I knew what png was (assume it wasn't a graphic file :-)...never hoid of wewak before...So...someone from Wewak would be a Wewaker? :-)



| Wewak is a place in PNG (Papua New Guinea), a country that neighbours
| Australia on our north
| --
| Cheers,
| Trevor L., WIP (Web Interested Person)
| Website: http://tandcl.homemail.com.au
|
| Rob Giordano (Crash Gordon®) wrote:
| > Wondering, but afraid to ask :-)
| >
| >
| > | >> Hi, wewak11,
| >>
| >> I wonder whether our US friends would know why I asked about PNG
| >> :-)))
| >>
| >> I would be interested to see your site sometime
| >> --
| >> Cheers,
| >> Trevor L.
| >> Website: http://tandcl.homemail.com.au
| >>
| >> wewak11 wrote:
| >>> Thanks a heap. I lived in Wewak for 6 years in the 80's
| >>>
| >>> "Trevor L." wrote:
| >>>
| >>>> Hi wewak11
| >>>> (BTW, Are you from PNG?)
| >>>>
| >>>> You could try this code
| >>>> <html>
| >>>> <head>
| >>>> <script type="text/javascript">
| >>>> function select()
| >>>> {
| >>>> no=Math.round(Math.random()*3)
| >>>> var randref
| >>>> = (no == 1) ? "http://members.ozemail.com.au/~fred.blow/"
| >>>> : (no == 2) ? "http://members.ozemail.com.au/~joe.bloggs/"
| >>>> : "http://google.com"
| >>>> document.getElementById('randlnk').innerHTML =
| >>>> '<a href="' + randref + '">Random Link</a>'
| >>>> }
| >>>> </script>
| >>>> </head>
| >>>>
| >>>> <body onload="select()">
| >>>> <span id="randlnk">link goes here</span>
| >>>> </body>
| >>>> </html>
| >>>>
| >>>> Change
| >>>> no=Math.round(Math.random()*3)
| >>>> to
| >>>> no=Math.round(Math.random()*100) or whatever the upper count is.
| >>>>
| >>>> Add extra elements after (no ==2)
| >>>> : (no == 3) ? "http://........./"
| >>>> : (no == 4) ? "http:/........../"
| >>>>
| >>>> This will place a hyperlink named Random Link on your page, and it
| >>>> will link randomly
| >>>>
| >>>> There may be a neater way to do it , such as placing the <a href
| >>>> ..> in the body of the code and amending its attributes with JS.
| >>>> However, I tested my code with genuine links and it worked.
| >>>> --
| >>>> Cheers,
| >>>> Trevor L.
| >>>> Website: http://tandcl.homemail.com.au
| >>>>
| >>>> wewak11 wrote:
| >>>>> I have a poetry site with about 100 pages. Can I put a random link
| >>>>> on the home page that will send visitors to a random page? As
| >>>>> always, thanks a heap, Graeme
| >>>>
| >>>>
| >>>> I choose Polesoft Lockspam to fight spam, and you?
| >>>> http://www.polesoft.com/refer.html
|
|
 
Back
Top