<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1015581" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1015581</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/need-random-link-script-not-normal-one#comment-1090332</link>
    <description> &lt;p&gt;try something like this, for demonstration purposes I have made a button to kickstart the process. You can change this to onload....&lt;/p&gt;
&lt;p&gt;Basically what happens is there is an array of affiliate numbers which is accessed at random. You can simply add the value to the link at runtime. Keep in mind that the random function returns 5 possible numbers. To increase or decrease this and the number of entries in the array you need to count from 0 not 1.&lt;/p&gt;
&lt;p&gt;ie to have an array of 10 numbers in the random function you need to multiply the result by 9 not 10... in the quick example here, there is an array of 5 numbers so the random function is multiplied by 4 not 5...&lt;/p&gt;
&lt;p&gt;here it is:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;DOCTYPE HTML &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;PUBLIC \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;-//W3C//DTD HTML 4.0 Transitional//EN\&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;random affiliate link thingy....&amp;lt;/title&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;amp;lt;script language=\&quot;JavaScript\&quot;&amp;amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;function get_random()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var ranNum= Math.round(Math.random()*4);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ranNum;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function getAffiliate()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; var whichAff=get_random();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var affno=new Array(5)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; affno[0]=\&quot;affiliate no 1\&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; affno[1]=\&quot;affiliate no 2\&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; affno[2]=\&quot;affiliate no 3\&quot;;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; affno[3]=\&quot;affiliate no 4\&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; affno[4]=\&quot;affiliate no 5\&quot;;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;document.write(affno[whichAff]);&lt;br /&gt;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;//--&amp;gt;&lt;br /&gt;&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;&amp;lt;/HEAD&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;BODY &amp;gt;&lt;br /&gt;&amp;lt;FORM name=\&quot;form1\&quot;&amp;gt;&lt;br /&gt;&amp;lt;INPUT TYPE=\&quot;button\&quot; value=\&quot;Get a Quote!\&quot; onClick=\&quot;getAffiliate()\&quot;&amp;gt;&lt;br /&gt;&amp;lt;/FORM&amp;gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;lt;!-- to change it to an onload function, simply remove the button and&lt;br /&gt; replace the body tag with this one&amp;nbsp; &amp;lt;BODY onload=\&quot;getAffiliate()\&quot;&amp;gt; --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/BODY&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;/html&amp;gt;&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 23 Sep 2001 12:07:57 +0000</pubDate>
 <dc:creator>detox</dc:creator>
 <guid isPermaLink="false">comment 1090332 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
