Eduardo DB Posted August 27, 2011 Report Share Posted August 27, 2011 To montando um sistema de pesquisa pelo codigona folha onde ta a relacao sempre sai 5 digitos então se o codigo for 25 vai sair 00025e tem algumas pessoas digitando pelo menos 1 desses zeros queria saber se tem como colocar pra se no campo iniciar por 0 ele deleta automaticamente tpw digita 010 ele deleta o 0 inicial e pesquisa 10 Quote Link to comment Share on other sites More sharing options...
0 vini_loock Posted August 27, 2011 Report Share Posted August 27, 2011 faz algo tipo:var string = '0235'.replace(/^0/g, '')Isso ai era pra funcionar. Quote Link to comment Share on other sites More sharing options...
0 Eduardo DB Posted August 27, 2011 Author Report Share Posted August 27, 2011 (edited) não deu :mellow:A Pagina essa<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Pesquisa Endereço</title> </head> <body onload="vForm()"> <script type="text/javascript" src="JS/wz_tooltip.js"></script> <script language="JavaScript"> function vForm(){ d = document.form1; d.cod.focus(); } </script> <link rel="stylesheet" type="text/css" href="JS/shadowbox.css"> <link rel="stylesheet" type="text/css" href="JS/index.css"> <script type="text/javascript" src="JS/shadowbox.js"></script> <script type="text/javascript" src="JS/wz_tooltip.js"></script> <script type="text/javascript"> Shadowbox.init(); </script> <? include "conexao.php"; $cod = $_POST['cod']; ?> <table border="0" align="center" background="img/bg.png"> <tr> <td height="26"><form id="form1" name="form1" method="post" action="index.php?funcao=exibe""> Codigo:<input type="text" name="cod" id="cod" /> </td><td><input type="image" name="button" id="button" src="img/busca.png" width="80" height="20"/> </form></td> <td width="8" height="26"> </td> <td width="85" height="26" valign="middle"><a href="add.php" ><img src="img/add.png" height="20" width="120"/></a></td> <td width="8" height="26"> </td> <td width="85" height="26" valign="middle"><a href="" onClick="window.open('consulta.php','Janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=300,left=25,top=25'); return false;"><img src="img/consulta.png" height="20" width="120"/></a></td> </tr> </table> <? if($_GET['funcao'] == "exibe"){ $pega_cod = $_POST['cod']; $pega_cod2 = $_GET['cod']; if(empty($pega_cod)){ $exibe_cod = $pega_cod2; }else{ $exibe_cod = $pega_cod; } ?> <? $exibe_sql = mysql_query("SELECT * FROM prod WHERE cod = '$exibe_cod'"); while($exibe_c=mysql_fetch_array($exibe_sql)){ $verifica_name = $exibe_c['prod']; if(empty($verifica_name)){ $nome_prod = 'Produto não cadastrado'; }else{ $nome_prod = $exibe_c['prod']; } $marca_prod = $exibe_c['Marca']; $exibe_forn = mysql_query("SELECT * FROM forn WHERE COD = '$marca_prod'"); while($exibe_f=mysql_fetch_array($exibe_forn)){ $marca_n = $exibe_f['NOME']; }} ?> <bR><bR> <table border="0" align="center" background="img/bg.png"> <tr> <td><? echo $exibe_cod;?> - <? echo $nome_prod;?> - <? echo $marca_n;?></td> </tr> </table> <br><bR><div align="center"> <? $link = '<a rel="shadowbox[Mixed];width=220;height=38" href="del.php?id='; $link2 = '&cod='; $link3 = '"> <img src="img/del.png" width="20" height="20"/></a>'; $div = '<div onmouseover="Tip('; $div1 = "'"; $div2 = ')" onmouseout="UnTip()" />'; $div3 = '</div>'; $colunas="5"; $cont="1"; print"<table background='img/bg.png'>"; $s = mysql_query("SELECT * FROM end WHERE cod = '$exibe_cod' LIMIT 40"); while($x=mysql_fetch_array($s)){ $end = strtoupper($x['end']); $id = $x['id']; $dcod = $exibe_cod; $data = $x['data']; if($cont==1){ print'<tr>'; } print'<td width="60">'; print $div; print $div1; print $data; print $div1; print $div2; print $end; print $div3; print '</td><td> </td><td>'; print $link; print $id; print $link2; print $dcod; print $link3; print"</td><td> </td>"; if($cont==$colunas){ print"</tr>"; $cont=0; } $cont=$cont+1; } if(!$cont==$colunas){ print"</tr></table>"; } else { print"</table>"; } }?> </table></div> </body> </html> Edited August 27, 2011 by Eduardo DB Quote Link to comment Share on other sites More sharing options...
0 Willian Gustavo Veiga Posted August 27, 2011 Report Share Posted August 27, 2011 O que aconteceu? Erros?Sempre passe o máximo de detalhes possíveis.Um abraço. Quote Link to comment Share on other sites More sharing options...
0 Eduardo DB Posted August 27, 2011 Author Report Share Posted August 27, 2011 (edited) nenhum erro so não aconteceu nadaCodigo da pagina acima Edited August 27, 2011 by Eduardo DB Quote Link to comment Share on other sites More sharing options...
Question
Eduardo DB
To montando um sistema de pesquisa pelo codigo
na folha onde ta a relacao sempre sai 5 digitos então se o codigo for 25 vai sair 00025
e tem algumas pessoas digitando pelo menos 1 desses zeros queria saber se tem como colocar pra se no campo iniciar por 0 ele deleta automaticamente
tpw
digita 010 ele deleta o 0 inicial e pesquisa 10
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.