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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.