The first step in using this script is to select the code in the text below and copy it to the rand.js folder.
var mess = new Array('code0','code1 ','code2');
var max = mess.length;
var num = Math.floor((Math.random() * max));
document.writeln(mess[num]) ;
Now you need to update this code to specify the image or reference you need. First, you repeat the code() line as many times as needed until the array contains all the entries you need in the random selection (example: its starting value is 3, which means if you have 10 entries, Then just repeat the line 7 times).
If you are using references, you just need to simply replace code(), code1, code2 with the text above. If you want to use this to display random images, then you need to put the HTML code for all images into the entry. You can create any type of code for your web page by placing the appropriate HTML and text into the entry, again chosen randomly.
Finally, use the following code to attach the script to the main part of your web page, where you need to display links or information:
< script type="text/javascript" src="rand.js"> < /script>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn