-
Javacript Functions
Is there any way I can make a javascript function go through all the images in a directory? Or through images which are listed?
I could use
HTML Code:
var image = '1'
function ChangeBG1()
{
image = image+1;
}
So it goes threw files called 1,2,3,4,5 but once it reaches the end it won't go back to 1.
Thanks.
Edit: Its to change the background of a div when you click something :p
Moved by Agesilaus (Forum Moderator) from Design & Development: Please post in the correct forum next time. :)
-
Sorry to double post, i found a way around that, I just need one more thing.
I need it to send a URL into a form :l
The js is:
PHP Code:
<script language="javascript">
var hi_list = [1];
function changeimg(act,a){
switch (a){
case 0: hi_list[act] = hi_list[act]+1;
if(hi_list[act] > 10){hi_list[act] = 1;}
break;
case 1: hi_list[act] = hi_list[act]-1;
if(hi_list[act] < 1){hi_list[act] = 10;}
break;
}
n_src = 'http://habbcrazy.net/test/images/'+hi_list[0]+'.gif';
window.document.images['habboimg'].src = n_src;
form.urlpreview.value = 'http://habbcrazy.net/test/images/'+hi_list[0]+'.gif';
}
</script>
I tried this one, but didnt work (The field ID is "urlpreview")
PHP Code:
form.urlpreview.value = 'http://habbcrazy.net/test/images/'+hi_list[0]+'.gif';