Daniel-Aragon
11-25-2002, 11:22 PM
make the banner change randomly when you refresh
|
Click to See Complete Forum and Search --> : make the banner change randomly when you refresh Daniel-Aragon 11-25-2002, 11:22 PM make the banner change randomly when you refresh Rick Bull 11-26-2002, 04:26 AM The best way to do it is with a server-side language like PHP, ASP, Perl etc. Do you have any of them? If not I can give you a JavaScript. Daniel-Aragon 11-27-2002, 12:47 AM Originally posted by Rick Bull The best way to do it is with a server-side language like PHP, ASP, Perl etc. Do you have any of them? If not I can give you a JavaScript. JavaScript Rick Bull 11-27-2002, 05:56 AM Just put this where you need it to appear. You'll haev to edit the arrays to fit what you want. <script type="text/javascript"><!-- function randomNumber(maxValue, minValue) { //If minValue/maxValue is missing make it/them 0/1 if (minValue == null) minValue = 0; if (maxValue == null) maxValue = 1; //Return the number return (Math.round(maxValue * Math.random()) + minValue); } var outputs = new Array( "Output 1", "Output 2", "Output 3", "Etc." ); document.open(); document.writeln(outputs[randomNumber(outputs.length-1)]); document.close(); //--></script> Daniel-Aragon 11-27-2002, 04:42 PM Originally posted by Rick Bull Just put this where you need it to appear. You'll haev to edit the arrays to fit what you want. <script type="text/javascript"><!-- function randomNumber(maxValue, minValue) { //If minValue/maxValue is missing make it/them 0/1 if (minValue == null) minValue = 0; if (maxValue == null) maxValue = 1; //Return the number return (Math.round(maxValue * Math.random()) + minValue); } var outputs = new Array( "Output 1", "Output 2", "Output 3", "Etc." ); document.open(); document.writeln(outputs[randomNumber(outputs.length-1)]); document.close(); //--></script> when i put the location of the banner i want only text comes out Rick Bull 11-28-2002, 06:52 AM Just change the array values to the full text you want to appear, or modify the end bit to look something like this (I don't know exactly what you want); document.open(); document.write('<iframe src="'); document.writeln(outputs[randomNumber(outputs.length-1)]); document.write('" width="95%" height="200"><\/iframe>'); document.close(); Habbotransport 10-14-2006, 10:25 PM whats the code webdeveloper.com
Copyright WebMediaBrands Inc., All Rights Reserved. |