|
Javascript Photo GalleryFunctionsaddImgAdds an image to the gallery. All parameters except file are optional; missing values inherit the default value for that parameter. To explicitly use the default value for a attribute pass in null. See examples. All values are strings except width and height. Only values associated with an HTML element you've identified using
Note: the parameters below are listed in their default ordering. This may be changed to suit your needs via the
Examples:<script language="javascript" type="text/javascript"> addImg( "22.jpg", "Me on top of marshmallows", 440,323 ); addImg( "23.jpg", "Janet making pie sans crust?", 440, 582, "Pie Lady", "21 December, 2002", "© 2003 CookingBlunders.net"); addImg( "24.jpg", "Conventions are fun!", 440,323 ); addImg( "25.jpg", "No idea what this is a picture of", 440,323 ); addImg( "41.jpg", null, 440, 323, null, "6 June, 2004" ); </script> reorderArgsSet the function parameter ordering for All of the attributes need not be specified. Those not listed will be added automatically in the default order. See example.
Example:<script language="javascript" type="text/javascript"> reorderArgs( "file", "title", "extra1", "date" ); addImg( "22.jpg", "Marshmallows", "wholesale only", "21 December, 2002"); // using null to explicitly use default values addImg( "41.jpg", null, null, "March 1997" ); // assigning values to attributes not changed in reorderArgs addImg( "22.jpg", "Ice Cream", "retail", null, "", 400, 500 ); // implictly using defaults addImg( "grapeleaves.jpg" ); </script> In the above example four attributes were defined. What will be the fifth, six, etc? description, width, height, and so on until extra4. The order resumes using the remaining unxpecified attribues
of You may change the order at any time, even after you've begun adding images. getValueReturns an attribute's value for a given image or configuration variable such as directory. If no image index specified the current image is used. Not all attributes require an index.
Example:<script language="javascript" type="text/javascript"> var myStr=""; myStr= getValue( "title" ); </script> setElementIddefines parts of your HTML document to be used by the Photo Gallery script. The contents of these elements will be overwritten,
with the exception of the image element which must be assigned to an
Example:<img src="images/spacer.gif" border="0" width="1" height="1" id="thephoto"> <p id="caption"></p> <p id="photoinfo"></p> <span id="mythumbs"></span> <script language="javascript" type="text/javascript"> setElementId( "image", "thephoto" ); setElementId( "info", "photoinfo" ); setElementId( "description", "caption" ); setElementId( "thumbs", "mythumbs" ); </script>
| |||||||||||||||||||||||||||||||||||||||||
Script from PizzaByTheSlice.com. Visit the Javascript tips for instructions and latest version. |