hello guys, is there any one good enough to tell me how to show random pics in a frame each time my home page is loaded. i would appreciate if you tell me how to do it either in javascript or php. thanks a million times

Load this as your framed page, and be sure that you provide valid path and filename with your images or this will not work...

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Random Images with frame</title>
<base target="_self" />
<script type="text/javascript">

function randomPic()
{ 
var img = (document.all) ? document.all.myImage : document.getElementById('myImage');

var pic = [];
//The valid path and filename of your images that you wish to randomize must be declared here.

pic[0] = new Image();
pic[0].src = 'image1.jpg';
pic[1] = new Image();
pic[1].src = 'image2.jpg';
pic[2] = new Image();
pic[2].src = 'image1.jpg';
 for ( var x = 0; x <= pic.length; x++ ) { 
if (document.images && img) { img.src =pic[Math.floor(Math.random()*x)].src; } } }
window.onload = randomPic;
</script>
</head>
<body>
<div id="wrapper">
<img src="image.jpg" alt="Default Image" id="myImage" width="640" height="480" />
</div>
</body>
</html>

thank you very much for helping i hope that i could help you back some day.........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.