
cdfree
Membros-
Total de itens
8 -
Registro em
-
Última visita
Tudo que cdfree postou
-
Tenho um select com numero de contrato (vem do db), quero selecionar um contrato e obter o número da rubrica contabil e classificação para completar os <input type='text' id='rubrica/class'> segue codigo. não sei buscar os dois, só um. <html> <head> <?php header('Content-Type: text/html; charset=ISO-8859-1',true) ?> <script type="text/javascript"> function classificacao(termo) { if (termo=="") { document.getElementById("rubrica").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("rubrica").value=xmlhttp.responseText; document.getElementById("class").value=xmlhttp.responseText; } } xmlhttp.open("GET","busca.php?q="+termo,true); xmlhttp.send(); } </script> </head> <body> <?php include("../conexao.inc"); $itens = mysql_query("SELECT * FROM `contratos` order by contrato"); $num = mysql_num_rows($itens); # número de registros // seleção de contrato echo "<select id='contrato' name='contrato' onchange='classificacao(this.value)'>"; echo "<option value='' selected='selected'>-----1------</option>"; for($i=0; $i<$num; $i++) { $reg = mysql_fetch_row($itens); echo "<option value='$reg[1]' class='campo'>$reg[1]-$reg[7]</option>"; } echo"</select>"; ?> Rubrica<input type='text' id='rubrica' name='rubrica'>Classificação:<input type='text' id='class' name='class'> </body> </html>
-
Quero poder selecionar qual input usar cpf ou cnpj, e a seleção ser realizada pelo select segue código. (não esta bloqueando). <script src=mascara.js language="javascript"></script> <script> function teste() { var id = document.getElementById('pessoa').value; if(id == 'cnpj'){ document.getElementById('cnpj').disabled = this.checked; document.getElementById('cpf').style.backgroundColor = "#DCDCDC"; document.getElementById('cnpj').style.backgroundColor = "#ffffff"; } else { document.getElementById('cpf').disabled = this.checked; document.getElementById('cnpj').style.backgroundColor = "#DCDCDC"; document.getElementById('cpf').style.backgroundColor = "#ffffff"; } } </script> <select id="pessoa" name="pessoa" onChange="teste();"> <option value="cnpj">Pessoa Juridica</option> <option value="cpf">Pessoa fisica</option> </select> CNPJ:<input type="text" name='cnpj' id='cnpj' disabled maxlength='14' onkeyup="FormataCnpj(this,event)" /> CPF:<input type="text" name='cpf' id='cpf' disabled maxlength='14' onkeyup="FormataCpf(this,event)" />
-
não estou consuguindo incremenata variável $_POST[ ]; segue código: <?php # conexÆo com banco de dados $db = mysql_connect("127.0.0.1","brasilia","200230"); $link = mysql_select_db("orcamento",$db); $nome = $_POST['vl1']; $contrato = '027/2012'; if($nome != 0) { for ($i=1; $i<=12;$i++) { $incluir = mysql_query("INSERT INTO debito (contrato, data, valor) VALUES ('$contrato', '$i/2012' , $_POST['vl'.$i];)"); }} ?> formulário de envio: <script> function repete() { var valor = document.getElementById("info").value; { for(i=1; i<=12;i++) document.getElementById("vl"+i).value = valor;} } function soma() { var c1 = parseFloat(document.getElementById("info").value); var c2 = parseFloat(document.getElementById("vl1").value); var c3 = parseFloat(document.getElementById("vl2").value); var c4 = parseFloat(document.getElementById("vl3").value); var c5 = parseFloat(document.getElementById("vl4").value); var c6 = parseFloat(document.getElementById("vl5").value); var c7 = parseFloat(document.getElementById("vl6").value); var c8 = parseFloat(document.getElementById("vl7").value); var c9 = parseFloat(document.getElementById("vl8").value); var c10 = parseFloat(document.getElementById("vl9").value); var c11 = parseFloat(document.getElementById("vl10").value); var c12 = parseFloat(document.getElementById("vl11").value); if (isNaN(c1)) c1 = 0; if (isNaN(c2)) c2 = 0; if (isNaN(c3)) c3 = 0; if (isNaN(c4)) c4 = 0; if (isNaN(c5)) c5 = 0; if (isNaN(c6)) c6 = 0; if (isNaN(c7)) c7 = 0; if (isNaN(c8)) c8 = 0; if (isNaN(c9)) c9 = 0; if (isNaN(c10)) c10 = 0; if (isNaN(c11)) c11 = 0; if (isNaN(c12)) c12 = 0; var soma = (c1+c2+c3+c4+c5+c6+c7+c8+c9+c10+c11+c12); document.getElementById("total").value = parseFloat(soma.toFixed(2)); } </script> <form action=script.php method=post> <table border="0"><tr> <td> <input type=text id="info" onkeyup="repete();soma();" style='background:#ccc;'><br> <input type=text id="vl1" onkeyup="soma();"><br> <input type=text id="vl2" onkeyup="soma();"><br> <input type=text id="vl3" onkeyup="soma();"><br> </td> <td> <input type=text id="vl4" onkeyup="soma();"><br> <input type=text id="vl5" onkeyup="soma();"><br> <input type=text id="vl6" onkeyup="soma();"><br> <input type=text id="vl7" onkeyup="soma();"><br> </td> <td> <input type=text id="vl8" onkeyup="soma();"><br> <input type=text id="vl9" onkeyup="soma();"><br> <input type=text id="vl10" onkeyup="soma();"><br> <input type=text id="vl11" onkeyup="soma();"><br> <td></tr><tr><td colspan="2">VALOR TOTAL DO CONTRATO</td> <td align="right"><input type=text id="total" style='background:#ccc;'> </td> </tr></table> <input type=submit value=gravar> <input type=reset value=Limpar> </form>
-
Não sei por que não exibi a primeira casa decimal, e se tiver uma forma de resumir este código eu aceito sugestão. <!-- <script src=moeda.js language="javascript"></script> --> <form action=script.php method=post> <table border=0><tr><td> 01/20XX<input type="text" name=vl1 onkeypress="mudanome();soma();" id="nome" onKeyPress="return(MascaraMoeda(this,'.',',',event))"><br> 02/20XX<input type="text" name=vl2 id="vl2" onkeypress="soma();"/><br> 03/20XX<input type="text" name=vl3 id="vl3" onkeypress="soma();"/><br> 04/20XX<input type="text" name=vl4 id="vl4" onkeypress="soma();"/></td><td> 05/20XX<input type="text" name=vl5 id="vl5" onkeypress="soma();"/><br> 06/20XX<input type="text" name=vl6 id="vl6" onkeypress="soma();"/><br> 07/20XX<input type="text" name=vl7 id="vl7" onkeypress="soma();"/><br> 08/20XX<input type="text" name=vl8 id="vl8" onkeypress="soma();"/></td><td> 09/20XX<input type="text" name=vl9 id="vl9" onkeypress="soma();"/><br> 10/20XX<input type="text" name=vl10 id="vl10" onkeypress="soma();"/><br> 11/20XX<input type="text" name=vl11 id="vl11" onkeypress="soma();"/><br> 12/20XX<input type="text" name=vl12 id="vl12" onkeypress="soma();"/></td></tr><tr> <td colspan=2>VALOR TOTAL DO CONTRATO</td><td style='text-align:right'><input type="text" id="total" /></tr></tr> </table> <input type=submit value=enviar><input type=reset value=limpar> </form> <script> function mudanome() { for(i=1; i<=12; i++){ document.getElementById("vl"+i).value = document.getElementById("nome").value; } } function soma(){ var c1 = parseFloat(document.getElementById("vl1").value); var c2 = parseFloat(document.getElementById("vl2").value); var c3 = parseFloat(document.getElementById("vl3").value); var c4 = parseFloat(document.getElementById("vl4").value); var c5 = parseFloat(document.getElementById("vl5").value); var c6 = parseFloat(document.getElementById("vl6").value); var c7 = parseFloat(document.getElementById("vl7").value); var c8 = parseFloat(document.getElementById("vl8").value); var c9 = parseFloat(document.getElementById("vl9").value); var c10 = parseFloat(document.getElementById("vl10").value); var c11 = parseFloat(document.getElementById("vl11").value); var c12 = parseFloat(document.getElementById("vl12").value); if (isNaN(c1)) c1 = 0; if (isNaN(c2)) c2 = 0; if (isNaN(c3)) c3 = 0; if (isNaN(c4)) c4 = 0; if (isNaN(c5)) c5 = 0; if (isNaN(c6)) c6 = 0; if (isNaN(c7)) c7 = 0; if (isNaN(c8)) c8 = 0; if (isNaN(c9)) c9 = 0; if (isNaN(c10)) c10 = 0; if (isNaN(c11)) c11 = 0; if (isNaN(c12)) c12 = 0; var soma = parseFloat(c1+c2+c3+c4+c5+c6+c7+c8+c9+c10+c11+c12); document.getElementById("total").value = parseFloat(soma.toFixed(2)); } </script>
-
Desenvolvi um menu em CSS no internet explore tá uma maravilha, mas no chrome, opera e firefox tá uma bomba tudo fora do lugar. Poderiam me da uma dica para torna compatível.
-
Estou desenvolvendo um site, mas quero que ele seja compativel com internet explorer, google chrome e firefox. Quando eu defino as propriedades "CSS" para o internet explorer dá diferença no chrome e firefox sou iniciante, gostaria de saber se tem como definir um padrão que não de muita diferença.meu projeto esta dividido em três partes ( topo.inc(logo+banner), menu.inc lado esquerdo e iframe.inc inferior direito(conteúdo)) todos chamados através do @include "arquivo.inc";.
-
ESTOU COM UM PROJETO QUE SERÁ NECESSARIO ARMAZENAR ARQUIVOS = OU MAIORES QUE 2MB, PERGUNTO O QUE DEVO USAR MYSQL, FTP ECT. ACEITO SUGESTÕES...
-
Estou iniciando em php e gostaria de um tutorial passo-a-passo de como fazer uma página de cadastro em php/mysql p/ construir um site com acesso restrito login. O motivo de ser passo-a-passo para eu ir estudando a linguagem. ok