FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Javascript Gallery Help (get some FRIH$)





Banzai
Hi,

I am new to JavaScript and have coded a little galley script. But need help improving it.
Currently it will just load images in the current folder, assuming they are all numbered 1..2..3..4…..ect. with accompanying thumbnails. The code it put into a HTML file.

Code:

numberpics = 77;
var i = 0;
var temp1;
var temp2;
var tempstring;
var colls = 4;
var remainder;

document.write('<p align="center"> <DIV> ');

do
{
  i+=1;
  temp1 = "<A HREF=\"" + i + ".jpg" + "\" onClick=\"window.open(\'" + i + ".jpg" + "\', \'review\'); return false\">"
  temp2 = "<IMG SRC=" + i + "_tn.jpg> </A>";
  tempstring = temp1+temp2;
  document.write(tempstring);

  remainder = i%colls;
 
  if(remainder==0)
    {
     document.write(' </DIV></p>'); 
    }

//alert(i);
//alert(remainder);

} while (i < numberpics);


I would like to improve it so it’s a JS file rather than included in the HTML. The JS file will then need to take parameters, or read the appropriate information from a file.
Parameters it will need to take are folder of images and number of images.

I’ll give some points for anyone who can help.

Thanks.
MrBaseball34
This won't work on a website because your javascript won't have access to the directories that the images are stored in.

If you have PHP access, I can write you a short script to return a table of images from a directory.

Let me know asap.
Related topics
PHP Counter?
Gallery 2 Help
Picture gallery
Self Marking Quiz
Use Javascript to Validate from
Get week number from date
form mail problems (quality help=frih$)
May be HTML, Javascript, or PHP, I don't know.
Need Flash or Javascript Games
How to add hyperlink to the Combobox elements
Making some part of the form inactive/hidden
i am using chat box but its not refreshing automatically.
Translate a code into javascript language (help needed)
Are additional posts really needed?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.