Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde,
Então estou fazendo uma listagem aonde eu terei um item mais simples e se a pessoa tiver interesse ela clica no MAIS ( uma imagem ) e ira exibir a descrição(que possui varios campos) desse item, se possivel usar uma função em javascript para não dar reflash na tela
Codigo
comentei o Código mais ou menos
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<!--=============================ITEM SIMPLES============================-->
<table width="857" border="1">
<tr>
<td width="57">Cod. reg.:</td>
<td width="369">Nome:</td>
<td width="96">Telefone:</td>
<td width="94">Senha:</td>
<td width="106">Detalhe:</td>
</tr>
<?phprequire("config.php");
$sql=(" select idpedido as pedido,Data,forma,orcamento from orcamento where data='2010-05-12' and orcamento='pedido'");
$result=mysql_query($sql);
$resp=mysql_num_rows($result);
$i=0;
while($i < $resp){
$CODIGOVENDA=mysql_result($result,$i,"pedido");
$DESCRICAO=mysql_result($result,$i,"Data");
$QTD=mysql_result($result,$i,"forma");
$UNITARIO=mysql_result($result,$i,"orcamento");
?>
<!-- GERA A TABELA DOS ITENS SIMPLES E COLOCA O SINAL DE MAIS PARA DETALHAR O ITEM -->
<tr>
<td width="170" height="25"><?php if ($CODIGOVENDA==NULL){echo "Sem Registro";}else {echo $CODIGOVENDA;}?></td>
<td width="400" height="25"><?php if ($DESCRICAO==NULL){echo "Sem Registro";}else {echo $DESCRICAO;} ?></td>
<td width="129" height="25"><?php if ($QTD==NULL){echo "Sem Registro";}else {echo $QTD;}?></td>
<td width="129" height="25"><?php if ($UNITARIO==NULL){echo "Sem Registro";}else {echo $UNITARIO;} ?></td>
<td> <img src="mais.png" id="imgexpand" alt="" onclick="expandRpt('imgexpand');"/> </td><td>
<?php
$i++;
}
?>
<div id="divcaixa">
<div id="divWrapper">
<table cellpadding="0" cellspacing="0" border="0" >
<tr valign="top">
<td background="caixa1.png" width="200" height="156px" >
<table cellpadding="0" cellspacing="0" border="0" background="" width="100%" >
<tr><td colspan="10"><tr>
<!--============================= / ITEM SIMPLES============================-->
<!--============================= TEORICAMENTE CARREGARIA O DETALHE O ITEM ============================-->
<!-- COMESAMOS A CARREGAR OS DETALHES-->
<td width="57">Cod. reg.:</td>
<td width="369">Nome:</td>
<td width="96">Telefone:</td>
<td width="94">Senha:</td>
<td width="106">Senha:</td>
<td width="95">Senha:</td>
</tr>
<?php
require("config.php");
$sql=(" select CODIGOVENDA,DESCRICAO,QTD,UNITARIO,TOTAL,ENTREGUE from orcamentoITENS WHERE NUMERO=13 ");
$result=mysql_query($sql);
$resp=mysql_num_rows($result);
$i=0;
while($i < $resp){
$CODIGOVENDA=mysql_result($result,$i,"CODIGOVENDA");
$DESCRICAO=mysql_result($result,$i,"DESCRICAO");
$QTD=mysql_result($result,$i,"QTD");
$UNITARIO=mysql_result($result,$i,"UNITARIO");
$TOTAL=mysql_result($result,$i,"TOTAL");
$ENTREGUE=mysql_result($result,$i,"ENTREGUE");
?>
<!--GERA TABELA DOS DETALHES-->
<tr>
<td width="57"><?php if ($CODIGOVENDA==NULL){echo "Sem Registro";}else {echo $CODIGOVENDA;}?></td>
<td width="369"><?php if ($DESCRICAO==NULL){echo "Sem Registro";}else {echo $DESCRICAO;} ?></td>
<td width="96"><?php if ($QTD==NULL){echo "Sem Registro";}else {echo $QTD;}?></td>
<td width="94"><?php if ($UNITARIO==NULL){echo "Sem Registro";}else {echo $UNITARIO;} ?></td>
<td width="106"><?php if ($TOTAL==NULL){echo "Sem Registro";}else {echo $TOTAL;} ?></td>
<td width="95"><?php if ($ENTREGUE==NULL){echo "Sem Registro";}else {echo $ENTREGUE;} ?></td>
</tr>
<?php
$i++;
}
?>
<!--============================= / TEORICAMENTE CARREGARIA O DETALHE O ITEM ============================-->
<tr>
<td></tr>
</table>
</td>
</tr>
</table>
</div></div></td></tr>
<tr>
<td colspan="6"><div align="center"><a href="index.php">Voltar</a></div></td>
</tr>
</table>
<!--FUNÇÃO QUE FAZ APENAS EXPANDIR 1 ITEM-->
<script type="text/javascript">
function expandRpt(imgID) {
var obj = document.getElementById(imgID);
//alert(obj);
//alert(obj.src);
var rpt = document.getElementById('divWrapper');
//alert(rpt);
if (rpt.style.display == 'none') {
rpt.style.display = 'block';
obj.src = 'mais.png';
} else {
rpt.style.display = 'none';
obj.src = 'maismenor.png';
}
}
</script>
</body>
</html>
Valew galera...
Carregando comentários...