<div style="position:relative;"> <div id="gimenu" style="float:right;width:180px;"></div> <div id="gimgs" style="margin:2px 200px 2px 2px"> <img src="dir/img1.jpg" alt="Title img 1" onclick="window.open(this.src)" width="100" height="100"> <img src="dir/img2.jpg" alt="Text img2" onclick="window.open(this.src)" width="100" height="100"> </div> <br style="clear:both;"/> </div> <script type="text/javascript"><!-- // Display group of images with categories - coursesweb.net/javascript/ // HERE add the groups of images - "category_name": ['img_address1', 'img_address2'] var gimgs = { "Autumn Life": ['dir/img1.jpg', 'dir/img2.jpg'], "Nature": ['dir/picture1.jpg', 'dir/picture2.jpg', 'dir/picture3.jpg'], "Spring Dream": ['dir/photo1.jpg', 'dir/photo2.jpg', 'dir/photo3.jpg'] }; // Object for the group of images var setImgs = new Object(); // create and return the menu with image categories setImgs.getMenu = function(){ // traverse "gimgs" object, gets and create UL menu with category lists var re = '<ul>'; for(var gictg in gimgs) { re += '<li style="cursor:pointer;text-decoration:underline;" onclick="setImgs.getImgs(\''+ gictg+ '\')">'+ gictg+ '</li>'; } return re+ '</ul>'; } // traverse the category from "gimgs" object, indicated in gictg parameter, and display the images in #setimgs setImgs.getImgs = function(gictg) { var nrim = gimgs[gictg].length; var re = ''; for(var i=0; i<nrim; i++) { re += ' <img src="'+ gimgs[gictg][i]+ '" onclick="window.open(this.src)" height="100" />'; } document.getElementById('gimgs').innerHTML = re; } // adds in #gimenu the menu returned by getMenu() method document.getElementById('gimenu').innerHTML = setImgs.getMenu(); --></script>
It is important that the HTML tag in which the images are added to have id="gimgs", and the element for menu to have id="gimenu" .
<div id="gimgs"> <img src="dir/img1.jpg" alt="Title img 1" onclick="window.open(this.src)" width="100" height="100"> <img src="dir/img2.jpg" alt="Text img2" onclick="window.open(this.src)" width="100" height="100"> </div> <button onclick="setImgs.back();"><<</button> <button onclick="setImgs.next();">>></button> <script type="text/javascript"><!-- // Display group of images with Next, Back buttons - coursesweb.net/javascript/ // HERE add the groups of images // Each group into a [], with their SRC addres between quotes, separated by comma var gimgs = [ ['dir/img1.jpg', 'dir/img2.jpg'], ['dir/picture1.jpg', 'dir/picture2.jpg', 'dir/picture3.jpg'], ['dir/photo1.jpg', 'dir/photo2.jpg', 'dir/photo3.jpg'] ]; // Object for the group of images var setImgs = new Object(); setImgs.ig = 0; // store the index for Next /Back group // traverse the accessed group in gimgs (with "ig" index), and display the images in #setimgs setImgs.getImgs = function() { var nrim = gimgs[this.ig].length; var re = ''; for(var i=0; i<nrim; i++) { re += ' <img src="'+ gimgs[this.ig][i]+ '" onclick="window.open(this.src)" height="100" />'; } document.getElementById('gimgs').innerHTML = re; } // set the "ig" to access Next group setImgs.next = function(){ if(this.ig < (gimgs.length - 1)) this.ig++; else this.ig = 0; this.getImgs(); } // set the "ig" to access Previous group setImgs.back = function(){ if(this.ig > 0) this.ig--; else this.ig = gimgs.length - 1; this.getImgs(); } --></script>
<input type="checkbox" name="a_name" value="value" checked="checked" />
#id { background:url("path_to_image.png"); background-size:contain; background-repeat:no-repeat; }
var rest8_7 = 8 % 7; alert(rest8_7);
$nr = ceil(3.5); echo $nr; // 4