preciso de uma ajuda. Tenho um script em ASP mas não consigo colocar paginação nele, ou seja, gostaria de expor 15 registros por pagina e na medida que vai aumentando os cadastros vão surgindo em outra página, tipo, página 1 - página 2 e assim sucessivamente, abaixo o código em ASP que apresenta os registros, se alguém puder ajudar.
Abraços
Rogério
Neste código ele mostra todos os registros do banco, gostaria de mostrar 15 registros por página.
<script language="javascript">
<!--
function newWindow(mypage,myname,w,h) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
//settings += 'toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
win = window.open(mypage,myname,settings);
win.window.focus();
}
-->
</script><html>
<head>
<title>Concessionária Virtual | Semizeros do Grupo Dirija</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="robots" content="all">
<meta name="rating" content="general">
<meta name="copyright" content="Webmaster Dirija">
<meta name="expires" content="never">
<meta name="DC.Creator" content="Webmaster Dirija">
<link href="estilo.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
.style1 {font-size: 10px}
-->
</style>
</head>
<body scroll="auto">
<tr>
<td height="71" valign="top">
<p align="center">
<!-- #include file="db.inc" -->
<!-- #include file="funcoes.inc" -->
<HTML>
<HEAD>
<TITLE><%=nome_site%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content=ALL name=robots>
<script language=JavaScript type=text/javascript>
<!--
function abre_janela(width, height, nome, scrollbar)
{
var top;
var left;
top = ( (screen.height/2) - (height/2) )
left = ( (screen.width/2) - (width/2) )
window.open('',nome,'width='+width+',height='+height+',scrollbars='+scrollbar+',toolbar=no,location=no,status=no,menubar=no,resizable=no,left='+left+',top='+top);
}
//-->
</SCRIPT>
</HEAD>
<BODY class=texto bgColor=#014E83 leftMargin=0 topMargin=0 rightMargin=0>
</BODY>
</HTML><!-- #include file="config.inc" -->
<!-- #include file="db.inc" -->
<!-- #include file="funcoes.inc" -->
<%set RSConsulta = Server.CreateObject("AdoDB.RecordSet")
categoria = request("categoria")
subcategoria = request("subcategoria")
valori = request("valori")
valorf = request("valorf")
anoi = request("anoi")
anof = request("anof")
combustivel = request("combustivel")
CodigoOpcional = request("CodigoOpcional")
CodigoMarca = request("CodigoMarca")
CodigoModelo = request("CodigoModelo")
SQL = "Select Vei.*, Mar.Marca, Mode.Modelo, Mode.Versao, Cor.cor " & chr(13) & _
"from Veiculos Vei, Marcas Mar, Modelos Mode, Cores Cor " & chr(13) & _
"where Vei.CodigoMarca = Mar.CodigoMarca " & chr(13) & _
"and Vei.CodigoModelo = Mode.CodigoModelo " & chr(13) & _
"and Vei.CodigoCor = Cor.CodigoCor " & chr(13)
if CodigoMarca <> "" then
SQL = SQL & "and Mar.CodigoMarca = " & CodigoMarca & " " & chr(13)
end if
if CodigoModelo <> "" then
SQL = SQL & "and Mode.CodigoModelo = " & CodigoModelo & " " & chr(13)
end if
if Categoria <> "" then
SQL = SQL & "and Mar.CodigoMarca = " & Categoria & " " & chr(13)
end if
if SubCategoria <> "" then
SQL = SQL & "and Mode.CodigoModelo = " & SubCategoria & " " & chr(13)
end if
if valori <> "" then
SQL = SQL & "and Vei.preço >= " & replace(replace(valori,".",""),",",".") & " " & chr(13)
end if
if valorf <> "" then
SQL = SQL & "and Vei.preço <= " & replace(replace(valorf,".",""),",",".") & " " & chr(13)
end if
if anoi <> "" then
SQL = SQL & "and Vei.AnoModelo >= " & anoi & " " & chr(13)
end if
if anof <> "" then
SQL = SQL & "and Vei.AnoModelo <= " & anof & " " & chr(13)
end if
if combustivel <> "" then
SQL = SQL & "and Vei.Combustivel = '" & combustivel & "' " & chr(13)
end if
if CodigoOpcional <> "" then
SQL = SQL & "and ( select count(*) from VeiculosOpcionais where Vei.CodigoVeiculo = VeiculosOpcionais.CodigoVeiculo and VeiculosOpcionais.CodigoOpcional in ( " & CodigoOpcional & " ) ) > 0 "
end if
'response.write "<pre>" & SQL & "</pre>"
'response.flush
RSConsulta.open SQL, conn, 1%>
<HTML>
<HEAD>
<TITLE><%=nome_site%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content=ALL name=robots>
<script language=JavaScript type=text/javascript>
<!--
function abre_janela(width, height, nome, scrollbar)
{
var top;
var left;
top = ( (screen.height/2) - (height/2) )
left = ( (screen.width/2) - (width/2) )
window.open('',nome,'width='+width+',height='+height+',scrollbars='+scrollbar+',toolbar=no,location=no,status=no,menubar=no,resizable=no,left='+left+',top='+top);
}
//-->
</SCRIPT>
<LINK href="estilo.css" type=text/css rel=stylesheet>
</HEAD>
<BODY class=texto bottomMargin=0 bgColor=#014E83 leftMargin=0 topMargin=0 rightMargin=0>
<TABLE class=texto style="BORDER-RIGHT: black 1px solid" height="100%" cellSpacing=0 cellPadding=0 width=760 bgColor=#ffffff border=0>
<TR>
<TD vAlign=top colSpan=3 height="1%">
<!-- #include file="topo.asp" -->
</TD>
</TR>
<TR>
<TD vAlign=top width=150 bgColor=whitesmoke>
<!-- #include file="menu.asp" -->
</TD>
<TD vAlign=top width=610>
<TABLE class=texto cellSpacing=0 cellPadding=0 width="100%" border=0>
<TR>
<TD vAlign=top>
<TABLE class=texto cellSpacing=0 cellPadding=4 width="95%" align=center border=0>
<TR>
<TD height=40>
<FONT color=#0071C5>
<STRONG>Nossos Veículos </STRONG>
</FONT>
</TD>
</TR>
<TR>
<TD>
Para ver detalhes do veículo, clique sobre o modelo.
<BR>
<HTML>
Caso não tenha encontrado o que procura, <STRONG><A href="<%=root%>contato.asp"><script type="text/javascript">
var GB_ROOT_DIR = "./greybox/";
</script>
<script type="text/javascript" src="greybox/AJS.js"></script>
<script type="text/javascript" src="greybox/AJS_fx.js"></script>
<script type="text/javascript" src="greybox/gb_scripts.js"></script>
<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="static_files/help.js"></script>
<link href="static_files/help.css" rel=+"stylesheet" type="text/css" media="all" />
</head>
<body>
<a href="http://estoquevu.dirija.com.br/carros/seminovos.htm" title="Estoque de Seminovos - Grupo Dirija" rel="gb_page_center[640, 460]">
Clique aqui </a>
</body></STRONG>
</html>e faça um anúncio de interesse de compra agora mesmo.<BR>
</TD>
</TR>
<TR>
<TD>
<TABLE class=texto cellSpacing=2 cellPadding=3 width="100%" border=0>
<TR bgColor=gainsboro>
<TD class=titulo_grid noWrap width="1%">
Foto
</TD>
<TD class=titulo_grid width="60%">
Veículo
</TD>
<TD class=titulo_grid width="1%">
Ano/Modelo
</TD>
<TD class=titulo_grid width="1%">
Km
</TD>
<TD class=titulo_grid width="1%">
Valor
</TD>
</TR>
<%while not RSConsulta.EOF%>
<TR onMouseMove="this.style.background='#EAEAEA'" style="CURSOR: hand" onClick="abre_janela(600,450, 'popup_6', 'yes');window.open('detalhe.asp?id=<%=RSConsulta("CodigoVeiculo")%>','popup_6')" onMouseOut="this.style.background='whitesmoke'" bgColor=whitesmoke>
<TD class=titulo3 noWrap><IMG height=45 src="<%=root%>central/veiculo/Imagem/<%=RSConsulta("FotoPrincipal")%>" width=60 border=0></TD>
<TD class=titulo3 noWrap>
<%=RSConsulta("Versao")%>
</TD>
<TD class=titulo3 noWrap>
<%=RSConsulta("AnoFabricacao")%>/<%=RSConsulta("AnoModelo")%>
</TD>
<TD class=titulo3 noWrap align=right>
<%=RSConsulta("KM")%>
</TD>
<TD class=titulo3 noWrap>
R$ <%=FormatNumber(RSConsulta("preço"),2)%>
</TD>
</TR>
<%RSConsulta.MoveNext
wend%>
</TABLE>
</TD>
</TR>
<TR><TD> </TD></TR>
</TABLE>
<BR><BR>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD vAlign=top colSpan=3 height="1%">
<!-- #include file="rodape.asp" -->
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<%RSConsulta.close
set RSConsulta = nothing
conn.close
set conn = nothing%>
Pergunta
Dirija
Olá pessoal,
preciso de uma ajuda. Tenho um script em ASP mas não consigo colocar paginação nele, ou seja, gostaria de expor 15 registros por pagina e na medida que vai aumentando os cadastros vão surgindo em outra página, tipo, página 1 - página 2 e assim sucessivamente, abaixo o código em ASP que apresenta os registros, se alguém puder ajudar.
Abraços
Rogério
Neste código ele mostra todos os registros do banco, gostaria de mostrar 15 registros por página.
<script language="javascript"> <!-- function newWindow(mypage,myname,w,h) { if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; }else{winl = 0;wint =0;} if (winl < 0) winl = 0; if (wint < 0) wint = 0; var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; //settings += 'toolbar=no,location=no,status=no,scrollbars=yes,resizable=no'; win = window.open(mypage,myname,settings); win.window.focus(); } --> </script><html> <head> <title>Concessionária Virtual | Semizeros do Grupo Dirija</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="robots" content="all"> <meta name="rating" content="general"> <meta name="copyright" content="Webmaster Dirija"> <meta name="expires" content="never"> <meta name="DC.Creator" content="Webmaster Dirija"> <link href="estilo.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); //--> </script> <style type="text/css"> <!-- .style1 {font-size: 10px} --> </style> </head> <body scroll="auto"> <tr> <td height="71" valign="top"> <p align="center"> <!-- #include file="db.inc" --> <!-- #include file="funcoes.inc" --> <HTML> <HEAD> <TITLE><%=nome_site%></TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content=ALL name=robots> <script language=JavaScript type=text/javascript> <!-- function abre_janela(width, height, nome, scrollbar) { var top; var left; top = ( (screen.height/2) - (height/2) ) left = ( (screen.width/2) - (width/2) ) window.open('',nome,'width='+width+',height='+height+',scrollbars='+scrollbar+',toolbar=no,location=no,status=no,menubar=no,resizable=no,left='+left+',top='+top); } //--> </SCRIPT> </HEAD> <BODY class=texto bgColor=#014E83 leftMargin=0 topMargin=0 rightMargin=0> </BODY> </HTML><!-- #include file="config.inc" --> <!-- #include file="db.inc" --> <!-- #include file="funcoes.inc" --> <%set RSConsulta = Server.CreateObject("AdoDB.RecordSet") categoria = request("categoria") subcategoria = request("subcategoria") valori = request("valori") valorf = request("valorf") anoi = request("anoi") anof = request("anof") combustivel = request("combustivel") CodigoOpcional = request("CodigoOpcional") CodigoMarca = request("CodigoMarca") CodigoModelo = request("CodigoModelo") SQL = "Select Vei.*, Mar.Marca, Mode.Modelo, Mode.Versao, Cor.cor " & chr(13) & _ "from Veiculos Vei, Marcas Mar, Modelos Mode, Cores Cor " & chr(13) & _ "where Vei.CodigoMarca = Mar.CodigoMarca " & chr(13) & _ "and Vei.CodigoModelo = Mode.CodigoModelo " & chr(13) & _ "and Vei.CodigoCor = Cor.CodigoCor " & chr(13) if CodigoMarca <> "" then SQL = SQL & "and Mar.CodigoMarca = " & CodigoMarca & " " & chr(13) end if if CodigoModelo <> "" then SQL = SQL & "and Mode.CodigoModelo = " & CodigoModelo & " " & chr(13) end if if Categoria <> "" then SQL = SQL & "and Mar.CodigoMarca = " & Categoria & " " & chr(13) end if if SubCategoria <> "" then SQL = SQL & "and Mode.CodigoModelo = " & SubCategoria & " " & chr(13) end if if valori <> "" then SQL = SQL & "and Vei.preço >= " & replace(replace(valori,".",""),",",".") & " " & chr(13) end if if valorf <> "" then SQL = SQL & "and Vei.preço <= " & replace(replace(valorf,".",""),",",".") & " " & chr(13) end if if anoi <> "" then SQL = SQL & "and Vei.AnoModelo >= " & anoi & " " & chr(13) end if if anof <> "" then SQL = SQL & "and Vei.AnoModelo <= " & anof & " " & chr(13) end if if combustivel <> "" then SQL = SQL & "and Vei.Combustivel = '" & combustivel & "' " & chr(13) end if if CodigoOpcional <> "" then SQL = SQL & "and ( select count(*) from VeiculosOpcionais where Vei.CodigoVeiculo = VeiculosOpcionais.CodigoVeiculo and VeiculosOpcionais.CodigoOpcional in ( " & CodigoOpcional & " ) ) > 0 " end if 'response.write "<pre>" & SQL & "</pre>" 'response.flush RSConsulta.open SQL, conn, 1%> <HTML> <HEAD> <TITLE><%=nome_site%></TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content=ALL name=robots> <script language=JavaScript type=text/javascript> <!-- function abre_janela(width, height, nome, scrollbar) { var top; var left; top = ( (screen.height/2) - (height/2) ) left = ( (screen.width/2) - (width/2) ) window.open('',nome,'width='+width+',height='+height+',scrollbars='+scrollbar+',toolbar=no,location=no,status=no,menubar=no,resizable=no,left='+left+',top='+top); } //--> </SCRIPT> <LINK href="estilo.css" type=text/css rel=stylesheet> </HEAD> <BODY class=texto bottomMargin=0 bgColor=#014E83 leftMargin=0 topMargin=0 rightMargin=0> <TABLE class=texto style="BORDER-RIGHT: black 1px solid" height="100%" cellSpacing=0 cellPadding=0 width=760 bgColor=#ffffff border=0> <TR> <TD vAlign=top colSpan=3 height="1%"> <!-- #include file="topo.asp" --> </TD> </TR> <TR> <TD vAlign=top width=150 bgColor=whitesmoke> <!-- #include file="menu.asp" --> </TD> <TD vAlign=top width=610> <TABLE class=texto cellSpacing=0 cellPadding=0 width="100%" border=0> <TR> <TD vAlign=top> <TABLE class=texto cellSpacing=0 cellPadding=4 width="95%" align=center border=0> <TR> <TD height=40> <FONT color=#0071C5> <STRONG>Nossos Veículos </STRONG> </FONT> </TD> </TR> <TR> <TD> Para ver detalhes do veículo, clique sobre o modelo. <BR> <HTML> Caso não tenha encontrado o que procura, <STRONG><A href="<%=root%>contato.asp"><script type="text/javascript"> var GB_ROOT_DIR = "./greybox/"; </script> <script type="text/javascript" src="greybox/AJS.js"></script> <script type="text/javascript" src="greybox/AJS_fx.js"></script> <script type="text/javascript" src="greybox/gb_scripts.js"></script> <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" src="static_files/help.js"></script> <link href="static_files/help.css" rel=+"stylesheet" type="text/css" media="all" /> </head> <body> <a href="http://estoquevu.dirija.com.br/carros/seminovos.htm" title="Estoque de Seminovos - Grupo Dirija" rel="gb_page_center[640, 460]"> Clique aqui </a> </body></STRONG> </html>e faça um anúncio de interesse de compra agora mesmo.<BR> </TD> </TR> <TR> <TD> <TABLE class=texto cellSpacing=2 cellPadding=3 width="100%" border=0> <TR bgColor=gainsboro> <TD class=titulo_grid noWrap width="1%"> Foto </TD> <TD class=titulo_grid width="60%"> Veículo </TD> <TD class=titulo_grid width="1%"> Ano/Modelo </TD> <TD class=titulo_grid width="1%"> Km </TD> <TD class=titulo_grid width="1%"> Valor </TD> </TR> <%while not RSConsulta.EOF%> <TR onMouseMove="this.style.background='#EAEAEA'" style="CURSOR: hand" onClick="abre_janela(600,450, 'popup_6', 'yes');window.open('detalhe.asp?id=<%=RSConsulta("CodigoVeiculo")%>','popup_6')" onMouseOut="this.style.background='whitesmoke'" bgColor=whitesmoke> <TD class=titulo3 noWrap><IMG height=45 src="<%=root%>central/veiculo/Imagem/<%=RSConsulta("FotoPrincipal")%>" width=60 border=0></TD> <TD class=titulo3 noWrap> <%=RSConsulta("Versao")%> </TD> <TD class=titulo3 noWrap> <%=RSConsulta("AnoFabricacao")%>/<%=RSConsulta("AnoModelo")%> </TD> <TD class=titulo3 noWrap align=right> <%=RSConsulta("KM")%> </TD> <TD class=titulo3 noWrap> R$ <%=FormatNumber(RSConsulta("preço"),2)%> </TD> </TR> <%RSConsulta.MoveNext wend%> </TABLE> </TD> </TR> <TR><TD> </TD></TR> </TABLE> <BR><BR> </TD> </TR> </TABLE> </TD> </TR> <TR> <TD vAlign=top colSpan=3 height="1%"> <!-- #include file="rodape.asp" --> </TD> </TR> </TABLE> </BODY> </HTML> <%RSConsulta.close set RSConsulta = nothing conn.close set conn = nothing%>Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.