...

View Full Version : Random Link, why doesnt it work?



sabian
03-27-2005, 12:12 AM
I am trying to get the following to work on Voisd.com (http://www.voisd.com) am i missing something? what am i doing wrong?

Heres the code (obviously ill have a number of different links, not the same one(s):



var r=Math.random()
if (r> 0 && r < 0.1)
{
document.write("<p><a href='http://www.bluecubegraphics.com' target='_blank'>UK Website Design and Print Marketing</a> - Bluecube Graphics is the perfect solution for all your web and print based design needs. We provide the highest of quality what ever your budget!</p>")
}
else if (r> 0.1 && r < 0.2)
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}
else
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}
else if (r> 0.3 && r < 0.4)
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}
else if (r> 0.4 && r < 0.5)
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}
else if (r> 0.5 && r < 0.6)
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}
else if (r> 0.6 && r < 0.7)
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}
else if (r> 0.7 && r < 0.8)
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}
else if (r> 0.8 && r < 0.9)
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}
else
{
document.write("<p><a href='http://www.wrenware.net' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>")
}


Frustration is the word of the day!!! Any help?

_Aerospace_Eng_
03-27-2005, 01:01 AM
is this ok?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
<!--
var theLinks = new Array()
theLinks[0] = "http://www.bluecubegraphics.com"
theLinks[1] = "http://www.wrenware.net"
theLinks[2] = "http://www.wrenware.net"
theLinks[3] = "http://www.wrenware.net"
theLinks[4] = "http://www.wrenware.net"
theLinks[5] = "http://www.wrenware.net"
theLinks[6] = "http://www.wrenware.net"

var j = 0
var p = theLinks.length;

var whichLink = Math.round(Math.random()*(p-1));
function showLink(){
document.write("<p><a href='"+theLinks[whichLink]+"' target='_blank'>Reliable Hosting Solutions</a> - Wrenware hosting provides the very best in online website hosting. What ever your requirements Wrenware has the perfection hosting solution.</p>");
}
//-->
</script>

</head>

<body>
<script type="text/javascript">
<!--
showLink();
//-->
</script>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum