Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Salve Salve galera.....
To precisando de ajuda para completar o form do meu site porém não to conseguindo finalizar, desenvolvido em ASP / Acess pelo Dreamweaver CS3.
Segue dúvida, já fiz um form que tem os seguintes campos:
Código / Imagem1 / Imagem2 / Produto / Características / Preço / Prioridade
E gostaria que ao cadastrar o produto o campo imagem2 ficasse vazio e quando fosse visualizado o produto na interface do usuário aparecesse uma "imagem padrão" substituindo o campo em branco.
Segue código abaixo:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
// *** Logout the current user.
MM_Logout = String(Request.ServerVariables("URL")) + "?MM_Logoutnow=1";
if (String(Request("MM_Logoutnow"))=="1") {
Session.Contents.Remove("MM_Username");
Session.Contents.Remove("MM_UserAuthorization");
var MM_logoutRedirectPage = "../index.asp";
// redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage == "") MM_logoutRedirectPage = String(Request.ServerVariables("URL"));
if (String(MM_logoutRedirectPage).indexOf("?") == -1 && Request.QueryString != "") {
var MM_newQS = "?";
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
if (String(items.item()) != "MM_Logoutnow") {
if (MM_newQS.length > 1) MM_newQS += "&";
MM_newQS += items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}
if (MM_newQS.length > 1) MM_logoutRedirectPage += MM_newQS;
}
Response.Redirect(MM_logoutRedirectPage);
}var i_produtos_cmd = Server.CreateObject ("ADODB.Command");
i_produtos_cmd.ActiveConnection = MM_con_fvsj_STRING;
i_produtos_cmd.CommandText = "SELECT * FROM produtos";
i_produtos_cmd.Prepared = true;
var i_produtos = i_produtos_cmd.Execute();
var i_produtos_numRows = 0;// set the record count
var i_produtos_total = i_produtos.RecordCount;
// set the number of rows displayed on this page
if (i_produtos_numRows < 0) { // if repeat region set to all records
i_produtos_numRows = i_produtos_total;
} else if (i_produtos_numRows == 0) { // if no repeat regions
i_produtos_numRows = 1;
}
// set the first and last displayed record
var i_produtos_first = 1;
var i_produtos_last = i_produtos_first + i_produtos_numRows - 1;
// if we have the correct record count, check the other stats
if (i_produtos_total != -1) {
i_produtos_numRows = Math.min(i_produtos_numRows, i_produtos_total);
i_produtos_first = Math.min(i_produtos_first, i_produtos_total);
i_produtos_last = Math.min(i_produtos_last, i_produtos_total);
}var MM_rs = i_produtos;
var MM_rsCount = i_produtos_total;
var MM_size = i_produtos_numRows;
var MM_uniqueCol = "Código";
MM_paramName = "codigo";
var MM_offset = 0;
var MM_atTotal = false;
var MM_paramIsDefined = (MM_paramName != "" && String(Request(MM_paramName)) != "undefined");
%>
<%
// *** Move To Specific Record: handle detail parameter
if (MM_paramIsDefined && MM_rsCount != 0) {
// get the value of the parameter
var param = String(Request(MM_paramName));
// find the record with the unique column value equal to the parameter value
for (MM_offset=0; !MM_rs.EOF; MM_offset++) {
if (MM_rs.Fields.Item(MM_uniqueCol).Value == param) break;
MM_rs.MoveNext();
}
// if not found, set the number of records and reset the cursor
if (MM_rs.EOF) {
if (MM_rsCount < 0) MM_rsCount = MM_offset;
if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;
MM_offset = 0;
// reset the cursor to the beginning
if (MM_rs.CursorType > 0) {
if (!MM_rs.BOF) MM_rs.MoveFirst();
} else {
MM_rs.Close();
MM_rs.Open();
}
}
}
%>
<%
// *** 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
i_produtos_first = MM_offset + 1;
i_produtos_last = MM_offset + MM_size;
if (MM_rsCount != -1) {
i_produtos_first = Math.min(i_produtos_first, MM_rsCount);
i_produtos_last = Math.min(i_produtos_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);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sistema Administrativo - Velas São João</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">font-family: Verdana;
font-size: 10px;
color: #FFCC33;
cursor: hand;
}background-color: #000000;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style1 {
font-size: 16px;
font-weight: bold;
}color: #333333;
text-decoration: none;
}text-decoration: none;
color: #333333;
}text-decoration: none;
color: #333333;
}text-decoration: none;
color: #666666;
}</style>
<script language="JavaScript" type="text/JavaScript">function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}</script>
</head>
<body>
<script type="text/ecmascript"></script>
<table width="100%" height="5" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="29"><font size="5" face="Impact" color="#333333">Sistema Administrativo - http://www.velassaojoao.com.br</font></td>
</tr>
<tr>
<td width="100%" height="21">
<p align="right"><font color="#C0C0C0">Bem Vindo ! </font></td>
</tr>
<tr>
<td width="100%" height="37" background="../../imagens/f_tab_adm.jpg" valign="middle">
<p align="right"><font color="#333333"><img src="../../imagens/b_adm.jpg" alt="Página Inicial Velas São João" border="0"> <a href="../ent.asp">Inicial</a> <img src="../../imagens/b_adm.jpg" alt="Todas as velas São João" border="0"> Todos os produtos <img src="../../imagens/b_adm.jpg" width="8" height="8"> <a href="<%= MM_Logout %>">Sair</a> </font></p></td>
</tr>
</table>
<br>
<form name="ed_prod" id="ed_prod">
<table width="621" border="2" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000">
<tr>
<td colspan="3"><div align="center" class="style1">
<div align="right" class="style2">Edição de Produto </div>
</div></td>
</tr>
<tr bgcolor="#333333">
<td height="36">Código:</td>
<td colspan="2" class="style3"><%=(i_produtos.Fields.Item("Código").Value)%></td>
</tr>
<tr bgcolor="#333333">
<td width="131" height="119">Imagem:</td>
<td width="282"><div align="center"> <img src="../../imagens/produtos/<%=(i_produtos.Fields.Item("imagem1").Value)%>.jpg" alt="Velas São João" width="120" height="100"> </div></td>
<td width="231"><div align="center"> <img src="<%=(i_produtos.Fields.Item("imagem2").Value)%>" alt="Velas São João" width="120" height="100"></div></td>
</tr>
<tr>
<td>Produto:</td>
<td colspan="2"><input name="produto" type="text" id="produto" value="<%=(i_produtos.Fields.Item("produto").Value)%>"></td>
</tr>
<tr bgcolor="#333333">
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td valign="top">Características:</td>
<td colspan="2"><textarea name="caracteristicas" cols="60" rows="6" id="caracteristicas"><%=(i_produtos.Fields.Item("caracteristicas").Value)%></textarea></td>
</tr>
<tr bgcolor="#333333">
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td>Preço</td>
<td colspan="2"><input name="preço" type="text" id="preço" value="<%=(i_produtos.Fields.Item("preco").Value)%>"></td>
</tr>
<tr bgcolor="#333333">
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td>Prioridade:</td>
<td colspan="2"><select name="prioridade" id="prioridade" title="<%=(i_produtos.Fields.Item("prioridade").Value)%>">
</select></td>
</tr>
<tr bgcolor="#333333">
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"><div align="right"><span class="links" onClick="MM_openBrWindow('../../upload/formulario1.html','Upload','width=300,height=110')">
<input name="submit" type="image" id="submit" src="../../imagens/b_atualizar.jpg" width="120" height="54" border="0">
</span></div></td>
</tr>
</table>
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>Essa é a página de visualização que deveria mostrar a "imagem padrão"
Se puderem ajudar, fico grato!
Abraços
Carregando comentários...