Presumably you'll use JavaScript to randomly display pictures. But what if the information of the picture (such as links) is constantly changing, or modified and added by the user? I have a way here.
Put the picture information (such as name, address, link, etc.) in a TXT file (if there is better MySQL, no). HTML file in the JavaScript call PHP program, PHP program randomly read picture data.
Readrand.php (this program is actually generating a JavaScript language)
?
$arrayall =file ("Tp.txt"); read out tp.txt content to array
$arrays =count ($arrayall);
if ($arrays ==1) {//because rand (0,0) is wrong
$selectrand = 0;
}else{
Srand ((double) Microtime () *1000000);/set random number of seeds
$selectrand =rand (0, $arrays-1);
}
$exstr =explode (Chr (9), $arrayall [$selectrand])//randomly remove one and split from all
?>
document.write (' <a href= "; echo $exstr [1];? > "target=" new "> "width=" "height=" "alt=" echo $exstr [0];? > "></a>");
HTML file
<body>
<script language= ' javascript ' src= ' readrand.php ' >
</script>
</body>
(You can put scripty in the position you need, and you can add settimeout () function to achieve timed refresh)
This paper collects and collates from the Internet, if you are the original author, please write a letter to change the author and source Zujizhe@Chinaz.com