Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Crystal

Condição

Recommended Posts

Estou fazendo um site para imobiliaria e na seção de terrenos preciso que o campo descrição apareça apenas quando estiver preenchido.

Acontece que quando programa o java a seguir, o titulo fica aparecendo em todos os itens relacionados e não aparece o conteúdo da descrição. Já tentei de tudo quanto foi maneira e não houve jeito.

Conto com vocês.

 

""<%@LANGUAGE="JAVASCRIPT"%>

<!--#include file="../../Connections/nova.asp" -->

<%

var dtlresid = Server.CreateObject("ADODB.Recordset");

dtlresid.ActiveConnection = MM_nova_STRING;

dtlresid.Source = "SELECT * FROM imoveis WHERE tipo = 'Terreno' ORDER BY codigo ASC";

dtlresid.CursorType = 0;

dtlresid.CursorLocation = 2;

dtlresid.LockType = 1;

dtlresid.Open();

var dtlresid_numRows = 0;

%>

<%

Session.LCID = 1046

%>

<%

var Repeat1__numRows = 10;

var Repeat1__index = 0;

dtlresid_numRows += Repeat1__numRows;

%>

<% var MM_paramName = ""; %>

<%

// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

 

// set the record count

var dtlresid_total = dtlresid.RecordCount;

 

// set the number of rows displayed on this page

if (dtlresid_numRows < 0) { // if repeat region set to all records

dtlresid_numRows = dtlresid_total;

} else if (dtlresid_numRows == 0) { // if no repeat regions

dtlresid_numRows = 1;

}

 

// set the first and last displayed record

var dtlresid_first = 1;

var dtlresid_last = dtlresid_first + dtlresid_numRows - 1;

 

// if we have the correct record count, check the other stats

if (dtlresid_total != -1) {

dtlresid_numRows = Math.min(dtlresid_numRows, dtlresid_total);

dtlresid_first = Math.min(dtlresid_first, dtlresid_total);

dtlresid_last = Math.min(dtlresid_last, dtlresid_total);

}

%>

<% var MM_paramName = ""; %>

<%

// *** Move To Record and Go To Record: declare variables

 

var MM_rs = dtlresid;

var MM_rsCount = dtlresid_total;

var MM_size = dtlresid_numRows;

var MM_uniqueCol = "";

MM_paramName = "";

var MM_offset = 0;

var MM_atTotal = false;

var MM_paramIsDefined = (MM_paramName != "" && String(Request(MM_paramName)) != "undefined");

%>

<%

// *** Move To Record: handle 'index' or 'offset' parameter

 

if (!MM_paramIsDefined && MM_rsCount != 0) {

 

// use index parameter if defined, otherwise use offset parameter

r = String(Request("index"));

if (r == "undefined") r = String(Request("offset"));

if (r && r != "undefined") MM_offset = parseInt®;

 

// if we have a record count, check if we are past the end of the recordset

if (MM_rsCount != -1) {

if (MM_offset >= MM_rsCount || MM_offset == -1) { // past end or move last

if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region

MM_offset = MM_rsCount - (MM_rsCount % MM_size);

} else {

MM_offset = MM_rsCount - MM_size;

}

}

}

 

// move the cursor to the selected record

for (var i=0; !MM_rs.EOF && (i < MM_offset || MM_offset == -1); i++) {

MM_rs.MoveNext();

}

if (MM_rs.EOF) MM_offset = i; // set MM_offset to the last possible record

}

%>

<%

// *** Move To Record: if we dont know the record count, check the display range

 

if (MM_rsCount == -1) {

 

// walk to the end of the display range for this page

for (var i=MM_offset; !MM_rs.EOF && (MM_size < 0 || i < MM_offset + MM_size); i++) {

MM_rs.MoveNext();

}

 

// if we walked off the end of the recordset, set MM_rsCount and MM_size

if (MM_rs.EOF) {

MM_rsCount = i;

if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;

}

 

// if we walked off the end, set the offset based on page size

if (MM_rs.EOF && !MM_paramIsDefined) {

if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region

MM_offset = MM_rsCount - (MM_rsCount % MM_size);

} else {

MM_offset = MM_rsCount - MM_size;

}

}

 

// reset the cursor to the beginning

if (MM_rs.CursorType > 0) {

if (!MM_rs.BOF) MM_rs.MoveFirst();

} else {

MM_rs.Requery();

}

 

// move the cursor to the selected record

for (var i=0; !MM_rs.EOF && i < MM_offset; i++) {

MM_rs.MoveNext();

}

}

%>

<%

// *** Move To Record: update recordset stats

 

// set the first and last displayed record

dtlresid_first = MM_offset + 1;

dtlresid_last = MM_offset + MM_size;

if (MM_rsCount != -1) {

dtlresid_first = Math.min(dtlresid_first, MM_rsCount);

dtlresid_last = Math.min(dtlresid_last, MM_rsCount);

}

 

// set the boolean used by hide region to check if we are on the last record

MM_atTotal = (MM_rsCount != -1 && MM_offset + MM_size >= MM_rsCount);

%>

<%

// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

 

// create the list of parameters which should not be maintained

var MM_removeList = "&index=";

if (MM_paramName != "") MM_removeList += "&" + MM_paramName.toLowerCase() + "=";

var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";

 

// add the URL parameters to the MM_keepURL string

for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {

var nextItem = "&" + items.item().toLowerCase() + "=";

if (MM_removeList.indexOf(nextItem) == -1) {

MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));

}

}

 

// add the Form variables to the MM_keepForm string

for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {

var nextItem = "&" + items.item().toLowerCase() + "=";

if (MM_removeList.indexOf(nextItem) == -1) {

MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));

}

}

 

// create the Form + URL string and remove the intial '&' from each of the strings

MM_keepBoth = MM_keepURL + MM_keepForm;

if (MM_keepBoth.length > 0) MM_keepBoth = MM_keepBoth.substring(1);

if (MM_keepURL.length > 0) MM_keepURL = MM_keepURL.substring(1);

if (MM_keepForm.length > 0) MM_keepForm = MM_keepForm.substring(1);

%>

<%

// *** Move To Record: set the strings for the first, last, next, and previous links

 

var MM_moveFirst="",MM_moveLast="",MM_moveNext="",MM_movePrev="";

var MM_keepMove = MM_keepBoth; // keep both Form and URL parameters for moves

var MM_moveParam = "index";

 

// if the page has a repeated region, remove 'offset' from the maintained parameters

if (MM_size > 1) {

MM_moveParam = "offset";

if (MM_keepMove.length > 0) {

params = MM_keepMove.split("&");

MM_keepMove = "";

for (var i=0; i < params.length; i++) {

var nextItem = params.substring(0,params.indexOf("="));

if (nextItem.toLowerCase() != MM_moveParam) {

MM_keepMove += "&" + params;

}

}

if (MM_keepMove.length > 0) MM_keepMove = MM_keepMove.substring(1);

}

}

 

// set the strings for the move to links

if (MM_keepMove.length > 0) MM_keepMove = Server.HTMLEncode(MM_keepMove) + "&";

var urlStr = Request.ServerVariables("URL") + "?" + MM_keepMove + MM_moveParam + "=";

MM_moveFirst = urlStr + "0";

MM_moveLast = urlStr + "-1";

MM_moveNext = urlStr + (MM_offset + MM_size);

MM_movePrev = urlStr + Math.max(MM_offset - MM_size,0);

%>

<script RUNAT=SERVER LANGUAGE=VBSCRIPT>

function DoCurrency(str, nDigitsAfterDecimal, nLeadingDigit, nUseParensForNeg, nGroupDigits)

DoCurrency = FormatCurrency(str, nDigitsAfterDecimal, nLeadingDigit, nUseParensForNeg, nGroupDigits)

End Function

</SCRIPT>

<script RUNAT=SERVER LANGUAGE=VBSCRIPT>

function CI_Preserve(str)

on error resume next

CI_Preserve = Replace(str,Chr(13),"<br>")

End Function

</SCRIPT>

<HTML>

<HEAD>

<TITLE></TITLE>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

<link href="../../css/modelo3.css" rel="stylesheet" type="text/css">

<link href="../../css/site.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/JavaScript">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features);

}

//-->

</script>

<style type="text/css">

<!--

.style6 {color: #000066}

.style7 {color: #000000}

-->

</style>

</HEAD>

<STYLE type="text/css">

<!--

BODY {

scrollbar-face-color:#ffffff;

scrollbar-highlight-color:#ffffff;

scrollbar-3dlight-color:#000080;

scrollbar-darkshadow-color:#ffffff;

scrollbar-shadow-color:#000000;

scrollbar-arrow-color:#000080;

scrollbar-track-color:#ffffff;

background-image: url(../../imagens/fundos/fundo2.jpg);

margin-left: 0px;

margin-top: 0px;

margin-right: 0px;

margin-bottom: 0px;

}

.style4 { font-size: 12px;

font-family: Verdana, Arial, Helvetica, sans-serif;

color: #FFFFFF;

font-weight: bold;

}

body,td,th {

color: #000066;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 10px;

}

.style5 {font-size: 12px; color: #000000; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif;}

-->

</STYLE>

<BODY LINK="#000000">

<form name="form1">

<% while ((Repeat1__numRows-- != 0) && (!dtlresid.EOF)) { %>

<% if (!dtlresid.EOF || !dtlresid.BOF) { %>

<table border="2" align="center" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">

<tr>

<td valign="top"><table border="0" align="center" cellpadding="2" cellspacing="2">

<tr bgcolor="#FFFFFF">

<td colspan="4"><div align="left"></div>

<div align="center"><span class="título8"><span class="titulo_br7">

</span></span></div></td>

</tr>

<tr bgcolor="#000066">

<td colspan="4"><div align="center" class="style4">Código:<span class="títuloverde"> <%=(dtlresid.Fields.Item("codigo").Value)%></span></div></td>

</tr>

<tr bgcolor="#FFFFFF">

<td colspan="2" rowspan="7" class="título8"><div align="center"></div> <div align="center"><img src="/imagens/residencial/<%=(dtlresid.Fields.Item("fotocapa").Value)%>" alt="Clique para ampliar" width="180" height="135"onClick="MM_openBrWindow('destaque.asp?<%= Server.HTMLEncode(MM_keepNone) + ((MM_keepNone!="")?"&":"") + "fotocapa=" + dtlresid.Fields.Item("fotocapa").Value %>','foto1','width=640,height=480')"></div></td>

<td width="87" bgcolor="#FFFFDF" class="título8"><div align="right">Categoria:</div></td>

<td width="397" bgcolor="#FFFFFF" class="texto12"><%=(dtlresid.Fields.Item("categoria").Value)%></td>

</tr>

<tr bgcolor="#FFFFFF">

<td bgcolor="#FFFFDF" class="título8"><div align="right">Tipo:</div></td>

<td class="texto12"><%=(dtlresid.Fields.Item("tipo").Value)%></td>

</tr>

<tr bgcolor="#FFFFFF">

<td bgcolor="#FFFFDF"><strong>Loteamento:</strong></td>

<td class="texto12"><%=(dtlresid.Fields.Item("descricao").Value)%></td>

</tr>

<tr bgcolor="#FFFFFF">

<td bgcolor="#FFFFDF"><div align="right"><b class="título8">Endereço:</b></div></td>

<td class="texto12"><%=(dtlresid.Fields.Item("endereço").Value)%></td>

</tr>

<tr bgcolor="#FFFFFF">

<td bgcolor="#FFFFDF"><div align="right"><b class="título8">Lote:</b></div></td>

<td bgcolor="#F4F4F4" class="texto12"><%=(dtlresid.Fields.Item("numero").Value)%></td>

</tr>

<tr bgcolor="#FFFFFF">

<td bgcolor="#FFFFDF"><div align="right"><span class="título8">Quadra:</span> </div></td>

<td bgcolor="#FFFFFF"><span class="texto12"><%=(dtlresid.Fields.Item("complemento").Value)%></span></td>

</tr>

<tr bgcolor="#FFFFFF">

<td height="18" bgcolor="#FFFFDF"><div align="right"><span class="título8">Bairro:</span></div></td>

<td bgcolor="#F7F7F7"><span class="texto12"><%=(dtlresid.Fields.Item("bairro").Value)%></span></td>

</tr>

<tr valign="top">

<td colspan="4" class="título8"><table width="100%" border="0" cellpadding="2" cellspacing="2">

<tr>

<td width="13%" bgcolor="#FFFFDE"><div align="right" class="título8">

<div align="right">Cidade:</div>

</div></td>

<td><span class="texto12"><%=(dtlresid.Fields.Item("cidade").Value)%>- <%=(dtlresid.Fields.Item("estado").Value)%></span></td>

</tr>

<tr>

<td height="22" bgcolor="#FFFFDE" class="título8"><div align="right">Área:</div></td>

<td bgcolor="#F7F7F7"><span class="texto12"><%=(dtlresid.Fields.Item("area").Value)%><img src="../../imagens/vinhetas/m2.gif" width="23" height="12" hspace="3"></span></td>

</tr>

<tr>

<td bgcolor="#FFFFDE">

</td>

</tr>

<tr>

<td bgcolor="#FFFFDE" class="título8"><div align="right"><span class="texto12"><b class="título8">Medidas:</b></span></div></td>

<td bgcolor="#F7F7F7" class="style5"><div align="left"><%=(dtlresid.Fields.Item("condicoes").Value)%><span class="texto10"></span></div></td>

</tr>

<tr>

<td bgcolor="#FFFFDE" class="título8"><span class="texto10 style7">

<%Desc=(dtlresid.Fields.Item("descrittr").Value)

if (Desc==' ') {Desc=" "} else {Desc="Descrição:"}%>

<span class="titulo8 style6"><%=Desc%></span> </span> </td>

<td bgcolor="#FFFFFF"><span class="texto10 style7">

<%Desc1=(dtlresid.Fields.Item("descrittr").Value)

if (Desc1==' ') {Desc1=" "} else {Desc1=(dtlresid.Fields.Item("descrittr").Value)}%>

<%=Desc1%></span></td> </tr>

<tr>

<td bgcolor="#FFFFDE" class="título8"><div align="right">Valor:</div></td>

<td bgcolor="#FFFFFF"><span class="texto12"><%= DoCurrency((dtlresid.Fields.Item("valor").Value), 2, -2, -2, -2) %></span></td>

</tr>

</table></td>

</tr>

<tr>

<td colspan="4"><table border="0" align="center" cellpadding="0" cellspacing="3">

<tr>

<td><img src="/imagens/residencial/<%=(dtlresid.Fields.Item("foto01").Value)%>" alt="Clique Para Ampliar" width="96" height="72" border="0" onClick="MM_openBrWindow('foto1.asp?<%= Server.HTMLEncode(MM_keepNone) + ((MM_keepNone!="")?"&":"") + "foto01=" + dtlresid.Fields.Item("foto01").Value %>','foto1','width=640,height=480')"></td>

<td><img src="/imagens/residencial/<%=(dtlresid.Fields.Item("foto02").Value)%>" alt="Clique Para Ampliar" width="96" height="72" border="0" onClick="MM_openBrWindow('foto2.asp?<%= Server.HTMLEncode(MM_keepNone) + ((MM_keepNone!="")?"&":"") + "foto02=" + dtlresid.Fields.Item("foto02").Value %>','foto2','status=yes,width=640,height=480')"></td>

<td><img src="/imagens/residencial/<%=(dtlresid.Fields.Item("foto03").Value)%>" alt="Clique Para Ampliar" width="96" height="72" border="0" onClick="MM_openBrWindow('foto3.asp?<%= Server.HTMLEncode(MM_keepNone) + ((MM_keepNone!="")?"&":"") + "foto03=" + dtlresid.Fields.Item("foto03").Value %>','foto3','width=640,height=480')"></td>

<td><img src="/imagens/residencial/<%=(dtlresid.Fields.Item("foto04").Value)%>" alt="Clique Para Ampliar" width="96" height="72" border="0" onClick="MM_openBrWindow('foto4.asp?<%= Server.HTMLEncode(MM_keepNone) + ((MM_keepNone!="")?"&":"") + "foto04=" + dtlresid.Fields.Item("foto04").Value %>','foto4','width=640,height=480')"></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table>

<% } // end !dtlresid.EOF || !dtlresid.BOF %>

<%

Repeat1__index++;

dtlresid.MoveNext();

}

%>

 

</form>

 

<table border="0" width="90%" align="center">

<tr>

<td width="31%" align="center"><div align="left">

<% if (MM_offset != 0) { %>

<a href="<%=MM_movePrev%>"><img src="../../imagens/anterior.gif" width="96" height="23" border=0></a>

<% } // end MM_offset != 0 %>

</div></td>

<td width="23%" align="center"><div align="right">

<% if (!MM_atTotal) { %>

<a href="<%=MM_moveNext%>"><img src="../../imagens/proxima.gif" width="96" height="23" border=0></a>

<% } // end !MM_atTotal %>

</div></td>

</tr>

</table>

 

<% if (dtlresid.EOF && dtlresid.BOF) { %>

<p align="center" class="titulosvermelho2">Não há imóveis com estas características a relacionar.</p>

<p align="center" class="titulosvermelho2">Contate nossa Imobiliária e teremos o maior prazer em encontrar o terreno de sua preferência. </p>

<% } // end dtlresid.EOF && dtlresid.BOF %>

</body>

<%

dtlresid.Close();

%>""

Compartilhar este post


Link para o post
Compartilhar em outros sites

Camarada,

 

Nesta parte do código:

<%Desc=(dtlresid.Fields.Item("descrittr").Value)if (Desc==' ') {Desc=" "} else {Desc="Descrição:"}%><span class="titulo8 style6"><%=Desc%></span> </span> </td><td bgcolor="#FFFFFF"><span class="texto10 style7"><%Desc1=(dtlresid.Fields.Item("descrittr").Value)if (Desc1==' ') {Desc1=" "} else {Desc1=(dtlresid.Fields.Item("descrittr").Value)}%><%=Desc1%></span></td> </tr>

você esta misturando as tag´s ASP com JavaScript e isso retorna erro msm. O problema é q

 

Camarada,

 

Nesta parte do código:

<%Desc=(dtlresid.Fields.Item("descrittr").Value)if (Desc==' ') {Desc=" "} else {Desc="Descrição:"}%><span class="titulo8 style6"><%=Desc%></span> </span> </td><td bgcolor="#FFFFFF"><span class="texto10 style7"><%Desc1=(dtlresid.Fields.Item("descrittr").Value)if (Desc1==' ') {Desc1=" "} else {Desc1=(dtlresid.Fields.Item("descrittr").Value)}%><%=Desc1%></span></td> </tr>

você esta misturando as tag´s ASP com JavaScript e isso retorna erro msm. O problema é q o sue código e gigante e não tenho mtas informações sobre o que desejas pois seu post foi mto lacônico.

 

Posso sugerir algo assim:

<%Desc=(dtlresid.Fields.Item("descrittr").Value)  if Desc="" then 	Desc=" "   else 	Desc="Descrição:"  End if%>	<span class="titulo8 style6"><%=Desc%></span> </span> </td>	<td bgcolor="#FFFFFF"><span class="texto10 style7">	<%Desc1=(dtlresid.Fields.Item("descrittr").Value)	if Desc1="" Then 	   Desc1=" " 	else 		Desc1=(dtlresid.Fields.Item("descrittr").Value)	End if%><%=Desc1%></span></td> </tr>

Da forma acima a sintaxe esta correta mas não garanto a lógica.

 

t+

Compartilhar este post


Link para o post
Compartilhar em outros sites

ele está "misturando" porque está usando JScript e não VbScript, infelizmente só manjo de VbScript

Compartilhar este post


Link para o post
Compartilhar em outros sites

utiliza assim

 

<% if (Desc==' '){  Desc =""} else { Desc = "Descrição: " + (dtlresid.Fields.Item("descrittr").Value)}%><span class="titulo8 style6"><%=Desc%></span> </span> </td><td bgcolor="#FFFFFF"><span class="texto10 style7"><%Desc1=(dtlresid.Fields.Item("descrittr").Value) if (Desc1==' ') {  Desc1=" " } else { Desc1 = "Descrição: " + (dtlresid.Fields.Item("descrittr").Value)}%><%=Desc1%></span></td>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.