Jump to content


Photo

Correr Um Lista Para Cima E Para Baixo


  • Faça o login para participar
1 reply to this topic

#1 MARQUESMARCIO

MARQUESMARCIO

    Normal

  • Usuários
  • 76 posts
  • Sexo:Não informado

Posted 04/09/2008, 16:38

Olá a todos, tenho este codigo para permitir ao clicar em 2 botoes um de up e outro de down para correr a lista para cima e para baixo.
O que acontece é que só o down funciona, o up não funciona.
O que estará errado no codigo ?

<script type="text/javascript">
	var last_new_count = 17;

	function scroller_count(mode){
		var max_count = document.getElementById("max_count");
		var error = document.getElementById("error");
		var count = 0;
		var new_count = 0;
		var current_row = "";
		var first = true;
		error.innerHTML="";
		if(mode == 'down'){
			for(count = 1; count <= parseInt(max_count.value); count++){
				current_row = document.getElementById("marker"+count);
				
				
				if(last_new_count >= 17){
					if(current_row.style.display==""){
						if(first==true){
							first=false;
						}				
					}
					
					if(first==false){
						new_count++;	
					}	
					
					if(new_count<=1){
						current_row.style.display="none";
					}
					else{
						if(new_count<=17 && new_count>=1){
							current_row.style.display="";						
						}
						else{
							current_row.style.display="none";						
						}
					}
				
				
				
				}
				/*
				if(current_row.style.display==""){
					error.innerHTML+="visible " + count + " nw=[" + new_count + "] <br />";
				}
				else{
					error.innerHTML+="not	 " + count + " nw=[" + new_count + "] <br />";
				}
				*/
			}
			last_new_count = new_count;
		}
		if(mode == 'up'){
			for(count = parseInt(max_count.value); count >= 1; count++){
				current_row = document.getElementById("marker"+count);
				
				
				if(count >= 1){
					if(current_row.style.display==""){
						if(first==true){
							first=false;
						}				
					}
					
					if(first==false){
						new_count--;	
					}	
					
					if(new_count<=1){
						current_row.style.display="none";
					}
					else{
						if(new_count<=28 && new_count>=1){
							current_row.style.display="";						
						}
						else{
							current_row.style.display="none";						
						}
					}
				
				
				
				}
				/*
				if(current_row.style.display==""){
					error.innerHTML+="visible " + count + " nw=[" + new_count + "] <br />";
				}
				else{
					error.innerHTML+="not	 " + count + " nw=[" + new_count + "] <br />";
				}
				*/
			}
			last_new_count_up = new_count;
		}
	}
</script>

<a style="" href="java script:scroller_count('up');"></a>
<a style="" href="java script:scroller_count('down');"></a>


#2 Alex Hiroshi

Alex Hiroshi

    Super Veterano

  • Ex-Admins
  • 4923 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP

Posted 05/09/2008, 11:21

Mostra algum erro de script? Tem esse script funcionando em alguma página online?
Fórum WMO - Equipe de Desenvolvimento / Banco de Dados - Ex-Administrador




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq