iloveny Posted March 16, 2007 Share Posted March 16, 2007 Hi folks! I wonder how did they do this: www.msn.com There is a little box on middle left where you can click next / previous to show the news. This is not a flash movie, so I wonder if we can do it in PHP? Many thanks in advanced!! Quote Link to comment https://forums.phpfreaks.com/topic/42988-slideshow-image-with-no-flash/ Share on other sites More sharing options...
only one Posted March 16, 2007 Share Posted March 16, 2007 javascript.... Quote Link to comment https://forums.phpfreaks.com/topic/42988-slideshow-image-with-no-flash/#findComment-208792 Share on other sites More sharing options...
christophe Posted March 16, 2007 Share Posted March 16, 2007 mmm ive seen lots of these in javascript heres one stick this in the head of your page <script> <!-- Begin var rotate_delay = 5000; // delay in milliseconds (5000 = 5 secs) current = 0; function next() { if (document.slideform.slide[current+1]) { document.images.show.src = document.slideform.slide[current+1].value; document.slideform.slide.selectedIndex = ++current; } else first(); } function previous() { if (current-1 >= 0) { document.images.show.src = document.slideform.slide[current-1].value; document.slideform.slide.selectedIndex = --current; } else last(); } function first() { current = 0; document.images.show.src = document.slideform.slide[0].value; document.slideform.slide.selectedIndex = 0; } function last() { current = document.slideform.slide.length-1; document.images.show.src = document.slideform.slide[current].value; document.slideform.slide.selectedIndex = current; } function ap(text) { document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop"; rotate(); } function change() { current = document.slideform.slide.selectedIndex; document.images.show.src = document.slideform.slide[current].value; } function rotate() { if (document.slideform.slidebutton.value == "Stop") { current = (current == document.slideform.slide.length-1) ? 0 : current+1; document.images.show.src = document.slideform.slide[current].value; document.slideform.slide.selectedIndex = current; window.setTimeout("rotate()", rotate_delay); } } // End --> </script> And then stick this were you want to display it Obviously change path to your images <form name=slideform> <img src="PATH_TO_IMAGE" name="show"> <select name="slide" onChange="change();"> <option value="PATH_TO_IMAGE" selected>lob_1 <option value="PATH_TO_IMAGE">lob_2 <option value="PATH_TO_IMAGE">lob_3 <option value="PATH_TO_IMAGE">lob_4 <option value="PATH_TO_IMAGE">lob_5 </select> <input type=button onClick="first();" value="|<<" title="Beginning"> <input type=button onClick="previous();" value="<<" title="Previous"> <input type=button name="slidebutton" onClick="ap(this.value);" value="Start" title="AutoPlay"> <input type=button onClick="next();" value=">>" title="Next"> <input type=button onClick="last();" value=">>|" title="End"> </form> Regards Alex Quote Link to comment https://forums.phpfreaks.com/topic/42988-slideshow-image-with-no-flash/#findComment-208838 Share on other sites More sharing options...
iloveny Posted March 17, 2007 Author Share Posted March 17, 2007 Hi! Thanks a lot guys for your help!!! Is it possible to integrate this JavaScript code with data that I will pull out from MySQL using PHP? In another word, I have to combine JavaScript with PHP code, is this possible? Thanks in advanced! Quote Link to comment https://forums.phpfreaks.com/topic/42988-slideshow-image-with-no-flash/#findComment-209316 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.