Jump to content


Photo

Redirecionar Links Dentro Da Mesma Pagina


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

#1 Gustavo Cotrim

Gustavo Cotrim

    Novato no fórum

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

Posted 29/09/2009, 15:04

e ai agalera blz, to com um problema, nao conheço quase nda de asp, e preciso implementar o seguinte, na mesma pagina quando clicar nos links tem que continuar na mesma pagina, mas aparecer somente o conteudo selecionado, eu sei fazer isso em php, me passaram um codigo em asp que é esse:
____________________________ Funciona ________________________________________

[codebox]<a href="teste.asp?d=1">teste</a>
<a href="teste.asp?d=2">teste</a>

<%

d=Request.QueryString("d")

select case d
case 1
%>
Conteudo 1
<%
case 2
%>
Conteudo 3
<%
end select
%>[/codebox]
__________________________________________________________

Não estou conseguindo implementar isso nesse codigo:
[codebox]
<a href="index.asp?d=1">menu1</a>
<a href="index.asp?d=2">menu2</a>

<form id="FormTabela" name="FormTabela" method="post" >
<table width="568" align="center" cellpadding="0" cellspacing="0" style="margin-top:10px">

<%

sql = "Select DISTINCT p.id , p.produto , p.apresentacao ,p.img , p.categoria , v.tipo_desc_id , v.prod_id,v.pf,v.pmc,r.estado,r.tipo_desc_id "&_
" from produtos as p , valores as v,relacionamento as r "&_
" where (p.id = v.prod_id and r.estado = '"&Session("cad_estado")&"' and r.tipo_desc_id = v.tipo_desc_id) "&_
"order by p.categoria"
'response.write sql
SET proRS = conexao.execute(sql)
x=0
banner1=""
banner2=""
banner3=""
while not proRS.eof%>
<tr>
<td colspan="5" >


<% 'response.write proRS("categoria")%>
<%if proRS("categoria") = "2" then
if banner1 = "" then banner1 = 1
if banner1 = 1 then%>
<img src="img/otc.jpg" width="568" height="45" style="margin-top:13px;margin-bottom:5px"/>
<%banner1 = banner1 + 1
end if
end if

if proRS("categoria") = "3" then
if banner2 = "" then banner2 = 1
if banner2 = 1 then%>
<img src="img/fito.jpg" width="568" height="45" style="margin-top:13px;"/>
<%banner2 = banner2 + 1
end if
end if
if proRS("categoria") = "4" then
if banner3 = "" then banner3 = 1
if banner3 = 1 then%>
<img src="img/similar.gif" width="568" height="45" style="margin-top:13px;"/>
<%banner3 = banner3 + 1
end if
end if %>
</td>
</tr>

<tr height="35">
<td width="109" height="107" align="center" style="border-right:solid 2px #B2B1B1"> <img src="produtos/<%=proRS("img")%>"></td>
<td width="190" style="padding-left:10px;border-right:solid 2px #B2B1B1">
<div class="destaqueV"><%=proRS("produto")%></div>
<br><br>
<div class="destaqueA"><%=proRS("apresentacao")%></div></td>
<td width="80" align="center" style="border-right:solid 2px #B2B1B1">

<input type="text" name="qtd" class="inputP" id="valorP<%=x%>" valor="<%=proRS("pf")%>"
itens_prod_id="<%=proRS("id")%>" style="color:#2B527B;font-weight:bold;" onKeyUp="apenasNumeros(this);"/>

</td>
<td width="86" height="53" align="center" class="destaqueA" style="border-right:solid 2px #B2B1B1"><%=proRS("pf")%></td>
<td width="101" align="center" class="destaqueA" ><%=proRS("pmc")%></td>
</tr>
<tr >
<td height="10" colspan="5" align="center"><hr class="hrPrincipal"/></td>
</tr>
<%x=x+1
proRS.movenext
wend%>

<tr>
<td height="70" colspan="5">

<div class="destaqueTotal">TOTAL: </div>
<div class="destaqueValor">R$ <input name="SomaTotal" id="SomaTotal" value="<%=SomaTotal%>" class="inputInvisivel" readonly style="color:#FF0000;font-weight:bold;width:100px;"/></div>

</td>
</tr>
<tr height="35">
<td height="14" colspan="5" align="center">
<img src="img/btn_enviar.jpg" class="botao_login" onClick="return validaForm();" style="cursor:pointer;">
</td>
</tr>
</table>
</form>[/codebox]

Edição feita por: Renan L. Queiroz, 04/11/2009, 15:40.
Inclusão da tag [ codebox ] para impressão de scripts


#2 _zEek_

_zEek_

    12 Horas

  • Usuários
  • 140 posts
  • Sexo:Não informado
  • Localidade:MS

Posted 30/09/2009, 00:04

faça assim
<a href="teste.asp?d=1">teste</a>
<a href="teste.asp?d=2">teste</a>

<% 
d=request.querystring("d")
if d = 1 then 
%>

motra bloco 1

<% else %>

mostra bloco 2

<%end if%>

agora se tiver mais de 2 opções faz assim
<a href="teste.asp?d=1">teste</a>
<a href="teste.asp?d=2">teste</a>

<% 
d=request.querystring("d")
if d = 1 then 
%>

motra bloco 1

<% end if
if d = 2 then %>

mostra bloco 2

<%end if%>





1 user(s) are reading this topic

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

IPB Skin By Virteq