Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Random Link, why doesnt it work?

    I am trying to get the following to work on 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):

    Code:
    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?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    is this ok?
    Code:
    <!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>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •