/    Sign up×
Community /Pin to ProfileBookmark

random image per minute

How can I get random image per minute ??? it is working when the page is loaded. Iam looking for random per mintue

Regards

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisFeb 21.2007 — Show us how you are getting it now.
Copy linkTweet thisAlerts:
@Osama_2007authorFeb 23.2007 — Dear gil davis

Sorry i do not undersand your message: Show us how you are getting it now.

may be you also do not understand my question. Here I'll repeat my question is how can I get random image per minute ? for example I have 10 images, I had random function each time i refresh my web site home page i got diffrent image until here it's okay.

my requirement: Iam looking for random function to change the image each one minute or two minutes .. etc instead of refresh time.

Thank you for good time
Copy linkTweet thisAlerts:
@gil_davisFeb 23.2007 — Post your existing code
Copy linkTweet thisAlerts:
@Osama_2007authorFeb 24.2007 — <HTML>

<head>

<script>

img = new Array("img01.jpg","img02.jpg","img03.jpg","img04.jpg","img05.jpg","img06.jpg")

function random(mx) {

var dd=new Date();

return((Math.round(Math.abs(Math.sin(dd.getTime()))*1000000000)%mx));

}

function GetRefreshedPicture() {

var pth;

pth="http://yourwebsite/images/"+img [random(6)+1]+" ";

document.write('<img src='+pth+'>');

}

</script>

</head>

<BODY>

<TABLE WIDTH="500" HEIGHT="200" BORDER="1" CELLPADDING="5">

<TR>

<TD ALIGN="center">

<Script language="JavaScript">GetRefreshedPicture();</Script>

</TD>

</TR>

</TABLE>

</BODY>

</HTML>
Copy linkTweet thisAlerts:
@gil_davisFeb 25.2007 — &lt;HTML&gt;
&lt;head&gt;
&lt;script&gt;
img = new Array("img01.jpg","img02.jpg","img03.jpg","img04.jpg","img05.jpg","img06.jpg")
function random(mx) {
var dd=new Date();
return((Math.round(Math.abs(Math.sin(dd.getTime()))*1000000000)%mx));
}
function GetRefreshedPicture() {
var pth;
pth="http://yourwebsite/images/"+img [random(6)+1]+" ";
[color=red]document.write("&lt;img name='i1' src="+pth+"&gt;");[/color]
}
[color=red]
function swap() {
pth="http://yourwebsite/images/"+img [random(6)+1]+" ";
document.images["i1"].src = pth;
}

function init() {
window.setInterval("swap()", 60*1000); // one minute
}[/color]
&lt;/script&gt;
&lt;/head&gt;
&lt;BODY [color=red]onload="init();"[/color]&gt;
&lt;TABLE WIDTH="500" HEIGHT="200" BORDER="1" CELLPADDING="5"&gt;
&lt;TR&gt;
&lt;TD ALIGN="center"&gt;
&lt;Script language="JavaScript"&gt;GetRefreshedPicture();&lt;/Script&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TABLE&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
Copy linkTweet thisAlerts:
@Osama_2007authorFeb 25.2007 — Thank you & have a nice day
×

Success!

Help @Osama_2007 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...