Jump to content

help with js news ticker


ROCKINDANO

Recommended Posts

Hello all,

 

Need help with a news ticker that i have. it reads and grabs data from a mysql table fine. the problem is when i click on next more than once it moves to fast to the other story and not give chance to read.

 

this is my js code page:

// JavaScript Document          
           first = 0;
           last = 10;
	     current = 1;
           
           function nextStory() {
               // Hide current picture
               object = document.getElementById('slide' + current);
               object.style.display = 'none';
               
               // Show next picture, if last, loop back to front
               if (current == last) { current = 1; }
               else { current++ }
//				   alert(current);
               object = document.getElementById('slide' + current);
               object.style.display = 'block';
				setTimeout(nextStory, 9000);
           }

           function previousStory() {
               // Hide current picture
               object = document.getElementById('slide' + current);
               object.style.display = 'none';
               
               if (current == first) { current = last; }
               else { current--; }
               object = document.getElementById('slide' + current);
               object.style.display = 'block';
           }         

 

this is my display php page. this is just the controls

          <div style="clear:both; position: relative; margin-top:-8px; margin-right:15px;" class="floatright"> <a href="javascript:previousStory()" style="margin-left: 10px;"> « Prev.</a> | <a href="javascript:nextStory()" style="margin-left: 10px;"> Next » </a> | <a href="latestnews.php" style="margin-left: 10px;">All
              News</a> </div>

 

can someone help me?

Link to comment
https://forums.phpfreaks.com/topic/206406-help-with-js-news-ticker/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.