Ir para conteúdo
Fórum Script Brasil

Tenko

Membros
  • Total de itens

    638
  • Registro em

  • Última visita

Posts postados por Tenko

  1. Tai maninho, desculpa a demora, é que o chefe estava na minha

    <html>

    <head>

    <title>

    </title>

    <script>

    function trataCliqueLogin( valor )

    {

    var blocoBuscaAvancada = document.getElementById( "divLogin"+valor );

    var lnkBuscaAvancada = document.getElementById( "lnkBuscaAvancada"+valor );

    var exibicaoAtual = blocoBuscaAvancada.style.display;

    if ( exibicaoAtual == "none" )

    {

    blocoBuscaAvancada.style.display = "block";

    lnkBuscaAvancada.innerHTML = "<b><font color='#000000'>««</font> Ver Detalhes</b>";

    }

    else

    {

    blocoBuscaAvancada.style.display = "none";

    lnkBuscaAvancada.innerHTML = "<b><font color='#000000'>»»</font> Ver Detalhes</b>";

    }

    }

    </script>

    </head>

    </head>

    <body>

    <table border="1" cellpadding="2" cellspacing="0" width="50%">

    <tr>

    <td>

    <a id="lnkBuscaAvancada1" href="#" onClick="trataCliqueLogin(1);" style="text-decoration:none">

    <b><font color="#000000">»»</font> Ver detalhes</b>

    </a>

    </td>

    <td>

    <a id="lnkBuscaAvancada2" href="#" onClick="trataCliqueLogin(2);" style="text-decoration:none">

    <b><font color="#000000">»»</font> Ver detalhes</b>

    </a>

    </td>

    </tr>

    <tr>

    <td>

    <div id="divLogin1" style="display: none">

    <table border="0" cellpadding="2" cellspacing="0" width="100%">

    <tr>

    <td>

    Este é um teste blá blá

    </td>

    </tr>

    <tr>

    <td>

    Esta é mais uma linha do teste

    </td>

    </tr>

    </table>

    </div>

    </td>

    <td>

    <div id="divLogin2" style="display: none">

    <table border="0" cellpadding="2" cellspacing="0" width="100%">

    <tr>

    <td>

    Este é um teste blá blá

    </td>

    </tr>

    <tr>

    <td>

    Esta é mais uma linha do teste

    </td>

    </tr>

    </table>

    </div>

    </td>

    </tr>

    </table>

    </body>

    </html>

  2. Que banco de dados você esta usando?

    Se for no MySql acho que não tem como( pelo menos diretamente ) gravar o valor com ponto.

    Então, você pode usar o campo valor como um campo char ou varchar, ou usar o campo como decimal e fazer o próprio PHP formatar pra você.

  3. <html>
        <head>
            <title>
            </title>
    
        <script>
    
          function trataCliqueLogin()
          {
             var blocoLogin  = document.getElementById( "divLogin" );
             var linkBuscaAvancada   = document.getElementById( "lnkBuscaAvancada" );
    
             var exibicaoAtual       = blocoLogin.style.display;
    
             if ( exibicaoAtual == "none" )
             {
                blocoLogin.style.display  = "block";
                linkBuscaAvancada.innerHTML       = "<b><font color='#000000'>««</font> Ver detalhes</b>";
             }
             else
             {
                blocoLogin.style.display  = "none";
                linkBuscaAvancada.innerHTML       = "<b><font color='#000000'>»»</font> Ver detalhes</b>";
             }
          }
    
        </script>
    
        </head>
        
        </head>
        
        <body>
        
        <a id="lnkBuscaAvancada" href="#" onClick="trataCliqueLogin();" style="text-decoration:none">
            <b><font color="#000000">»»</font> Ver detalhes</b>
        </a>
        
        <div id="divLogin" style="display: none">
        
            <table border="0" cellpadding="2" cellspacing="0" width="30%">
                <tr>
                    <td>
                        Este é um teste blá blá
                    </td>                
                </tr>
                <tr>
                    <td>
                        Esta é mais uma linha do teste
                    </td>                
                </tr>
        </table>
    
        </div>
        
        </body>
    
    </html>
    

  4. <style>

    .estilo {

    font-family: verdana;

    font-size: 12px;

    font-style: normal;

    line-height: normal;

    font-weight: bold;

    font-variant: normal;

    text-transform: none;

    color: #000000;

    }

    </style>

    <select name="select" class="estilo">

    <option value="teste">teste

    <option value="teste1">teste1

    </select>

  5. Do modo como você falou...

    if( $sUser == "adm" ) {

    header("Location: menu.php");

    }else if( $sUser == "normal" ){

    header("Location: menu2.php");

    }else{

    header("Location: erro.htm");

    }

  6. Pra quem tiver vontade de saber como funciona o AJAX.

    Aqui vai uma demonstração de busca por nome usando esse método legal..

    Salve esta 1º página como index.php

    <html>
    <head>
    <title>BUSCA DINÂMICA</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script src="script.js"></script>
        <script>
        function pesquisa(valor)
        {
            //FUNÇÃO QUE MONTA A URL E CHAMA A FUNÇÃO AJAX
            url="busca_nome.php?valor="+valor;
            ajax(url);
        }
        </script>
    </head>
    
    <body>
        <table width="657" border="1" cellpadding="2" cellspacing="0" bgcolor="#f7f7f7">
            <tr>
                <td align="center" bgcolor="#CCCCCC">
                    <strong>&lt;-
                        BUSCA DIN&Acirc;MICA -&gt;
                    </strong>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>
                        DIGITE AQUI O NOME DA PESSOA
                    </strong>:
                    <input type="text" name="nome" onKeyPress="pesquisa(this.value)">
                </td>
            </tr>
            <tr>
                <td>
                    <div id="pagina">
                    </div>
                </td>
            </tr>
    </table>
    
    </body>
    </html>
    Agora salve esta como script.js
    function ajax( url )
    {
    
        //alert( url );
        //alert(nick);
        //alert(dest);
        //alert(msg);
    
        req = null;
        // Procura por um objeto nativo (Mozilla/Safari)
        if (window.XMLHttpRequest) {
            req = new XMLHttpRequest();
            req.onreadystatechange = processReqChange;
            req.open("GET",url,true);
            req.send(null);
            // Procura por uma versão ActiveX (IE)
        }else if (window.ActiveXObject){
            req = new ActiveXObject("Microsoft.XMLHTTP");
            if (req){
                req.onreadystatechange = processReqChange;
                req.open("GET",url,true);
                req.send();
            }
        }
    }
    
    function processReqChange()
    {
    
        // apenas quando o estado for "completado"
        if (req.readyState == 4) {
    
            // apenas se o servidor retornar "OK"
            if (req.status ==200) {
    
            // procura pela div id="pagina" e insere o conteudo
            // retornado nela, como texto HTML
    
                document.getElementById('pagina').innerHTML = req.responseText;
            }else{
                alert("Houve um problema ao obter os dados:n" + req.statusText);
            }
        }
    }
    
    Enfim, salve este como busca_nome.php
    <?php
    
        require_once "lib/intranet.php"; // Minhas libs
        require_once "lib/start.php";
        
        $sNome = $_GET["valor"];
        $sNome = trim( $sNome );
    
        if( empty( $sNome )){
    
            echo "Digite algo";
    
        }else{
            $sSql    = " select * from tbl_usuario where nome like '" .$_GET[valor]. "%' ";
            $sResult = db_query( $sSql );
            $iLinhas = db_rows( $sResult );
    
            if( $iLinhas > 0){
                while( $sLinha = db_fetch_array( $sResult )){
                    echo $sLinha['nome']."<br>";
                }
            }
        }
    ?>
    

    Abraços pessoal

  7. você terá que usar JavaScript para fazer a consulta assim que o campo perder o Focus. É mais ou menos assim :

    <html>

    <head>

    <title>

    </title>

    <script Language="JavaScript" DEFER>

    function Enviar(){

    document.f1.action = 'index.php'

    document.f1.submit()

    }

    </script>

    </head>

    <body>

    <form method="post" action="index.php" name="f1">

    <input type="text" id="txtCep" size="10" name="txtCep" onBlur="java script:Enviar();">

    </form>

    </body>

    </html>

    Depois, você coloca os valores da consulta do cep nos campos,

    só isso.

    abraços

×
×
  • Criar Novo...