Ir para conteúdo
Fórum Script Brasil

Tenko

Membros
  • Total de itens

    638
  • Registro em

  • Última visita

Posts postados por Tenko

  1. Bom dia

    Vê se é isso que você quer:

    <html>
        <head>
            <title></title>
            
            <script>
            function travaDestrava( valor )
            {
                var oElementos = document.getElementsByTagName( 'input' );
                var iElementos = oElementos.length;
                
                for( var i = 0; i < iElementos; i++ )
                {
                    if( oElementos[ i ].id == valor )
                    {
                        oElementos[ i ].disabled = true;
                        oElementos[ i ].style.backgroundColor = '#f2f2f2';
                    }
                    else
                    {
                        oElementos[ i ].disabled = false;
                        oElementos[ i ].style.backgroundColor = '#ffffff';
                    }
                }
            }
            </script>
            
        </head>
        
        <body>
        
            <select id="selDia" onchange="java script:travaDestrava( this.value );">
                <option value="">:: Informe ::</option>
                <option value="18-05-2011">18-05-2011</option>
                <option value="19-05-2011">19-05-2011</option>
                <option value="20-05-2011">20-05-2011</option>
                <option value="21-05-2011">21-05-2011</option>
                <option value="22-05-2011">22-05-2011</option>
                <option value="23-05-2011">23-05-2011</option>
            </select>
        
            <br/>
            <br/>
        
            <input type="text" id='18-05-2011' value='18-05-2011' style="background-color:#ffffff"><br/>
            <input type="text" id='19-05-2011' value='19-05-2011' style="background-color:#ffffff"><br/>
            <input type="text" id='20-05-2011' value='20-05-2011' style="background-color:#ffffff"><br/>
            <input type="text" id='21-05-2011' value='21-05-2011' style="background-color:#ffffff"><br/>
            <input type="text" id='22-05-2011' value='22-05-2011' style="background-color:#ffffff"><br/>
            <input type="text" id='23-05-2011' value='23-05-2011' style="background-color:#ffffff"><br/>
        
        </body>
    </html>

  2. Bom dia.

    Vê se isto ajuda, fiz simples pra ser entendido.

    <html>

    <head>

    <title></title>

    <script>

    function gravadados()

    {

    var sUrl = 'gravadados.asp';

    var oElementos = document.getElementsByTagName( 'input' );

    var iElementos = oElementos.length;

    var sParametros = '?';

    for( var i = 0; i < iElementos; i++ )

    {

    if( oElementos[ i ].type == 'text' )

    {

    sParametros += oElementos[ i ].id + '=' + oElementos[ i ].value + '&';

    }

    }

    sParametros = sParametros.substr( 0, sParametros.length - 1 );

    alert(sUrl + sParametros)

    }

    </script>

    </head>

    <body>

    <input id="titulo" type="text" value="Meu T&iacute;tulo"/>

    <input id="texto" type="text" value="Meu Texto"/>

    <input id="professor" type="text" value="Meu Professor"/>

    <input id="Submit" type="submit" value="enviar mensagem" onclick="java script:gravadados();" />

    </body>

    </html>

  3. Boa tarde.

    <html>
        <head>
            <title></title>
            
            &lt;script>
    
            function exibeMsg( valor )
            {
                alert(valor)
                
                switch (valor)
                {
                    case '1':
                    document.getElementById( 'txt' ).innerHTML = 'Valor ' + valor + ' selecionado';
                    break;
    
                    case '2':
                    document.getElementById( 'txt' ).innerHTML = 'Valor ' + valor + ' selecionado';
                    break;
    
                    case '3':
                    document.getElementById( 'txt' ).innerHTML = 'Valor ' + valor + ' selecionado';
                    break;
    
                    default:
                    document.getElementById( 'txt' ).innerHTML = 'Nenhum valor informado';
                    break;
                }
            }
    
            </script>
            
        </head>
        
        <body>
        
            <select id="" onchange="exibeMsg(this.value);">
                <option value="">-- Selecione --</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select>
            
            <br/>
            
            <span id="txt">Nenhum valor informado</span>
        
        </body>
    </html>
    Melhor ainda. mude a função para
    function exibeMsg( valor )
            {
                switch (valor)
                {
                    case '':
                    document.getElementById( 'txt' ).innerHTML = 'Nenhum valor informado';
                    break;
    
                    default:
                    document.getElementById( 'txt' ).innerHTML = 'Valor ' + valor + ' selecionado';
                    break;
                }
            }

  4. Boa tarde.

    Vê se ajuda

    <html>

    <head>

    <title></title>

    <script>

    function validFone()

    {

    var fone = document.getElementById( 'fone' ).value;

    if( isNaN( fone ) || fone == '' )

    {

    alert( 'Erro' )

    document.getElementById('fone').value = '';

    document.getElementById('fone').focus();

    return false;

    }

    }

    </script>

    </head>

    <body>

    <form onsubmit="return validFone();">

    <input type="submit" value="Alterar Tamanho">

    <br/>

    <input type="text" value="" id="fone">

    </form>

    </body>

    </html>

  5. Boa tarde

    <html>

    <head>

    <title></title>

    <script>

    function mudaTamanho(tamanho)

    {

    document.getElementById( 'teste' ).width = parseInt( document.getElementById( 'teste' ).width ) + parseInt( tamanho );

    document.getElementById( 'teste' ).height = parseInt( document.getElementById( 'teste' ).height) + parseInt( tamanho );

    }

    </script>

    </head>

    <body>

    <input type="button" value="Alterar Tamanho" onclick="mudaTamanho(10);">

    <br/>

    <iframe src="teste.htm" width="150" height="250" id='teste'></iframe>

    </body>

    </html>

  6. Bom dia.

    Este é um exemplo simples

    <html>

    <head>

    <title></title>

    <script>

    function mostraOculta()

    {

    var oBloco = document.getElementById( 'bloco' );

    var sModo = oBloco.style.display;

    oBloco.style.display = ( sModo == 'block' ) ? 'none' : 'block' ;

    }

    </script>

    </head>

    <body>

    <input type="button" value="Mostra / Oculta" onclick="java script:mostraOculta()">

    <br/>

    <div style="border:1px solid #000000; background-color:#f2f2f2; padding: 10px; display:block" id="bloco">Tenko</div>

    </body>

    </html>

  7. Boa tarde.

    Não sei se entendi seu raciocínio direito, mas, vamos lá.

    Exemplo:

    Campo 1: 50

    Campo2 : 50

    Campo 3: 100

    Se você apagar o campo 2, porque você fará a conta do campo 1 – o campo 2, se a resposta seria somente o valor do campo 1?

    Acho que isso resolveria

    <html>
        <head>
            <title></title>
            
            &lt;script>
                function soma()
                {
                    var a = parseInt(document.getElementById('c1').value);
                    
                    a = ( isNaN( a ) ) ? 0 : a;
                    
                    var b = parseInt(document.getElementById('c2').value);
                    
                    b = ( isNaN( b ) ) ? 0 : b;
                    
                    var c = document.getElementById('c3').value = parseInt(a+B);
                }
            </script>
            
        </head>
        
        <body>
        
            <input type="text" id="c1" onchange="java script:soma()">
            <br>
            <input type="text" id="c2" onchange="java script:soma()">
            <br>
            <input type="text" id="c3">
         
        </body>
    </html>

  8. Boa tarde.

    Retirado do código fonte do seu site

    >> BEGIN OF TERMS OF USE. DO NOT EDIT OR DELETE THESE LINES. IF YOU EDIT OR DELETE THESE LINES AN ALERT MESSAGE MAY APPEAR WHEN TEMPLATE WILL BE ONLINE

    Resumindo

    >> INICIO DO TERMOS DE USO. Não edite ou apague estas linhas. Se você editar ou excluir essas linhas uma mensagem de alerta pode aparecer no modelo ONLINE

    Edite os arquivos Flash, podem estar ali tb

    Abraços

  9. Não entendi o que você quer, mas se for o que eu estou pesando isso ajuda você

    <?php
    
    function teste( $a )
    {
        switch ( $a )
        {
            // [ Mon Oct 04 14:18:49 BRT 2010 ] Comentário : Opções válidas
            case 1: return 'A'; break;
            case 2: return 'B'; break;
            case 3: return 'C'; break;
            case 4: return 'D'; break;
            case 5: return 'E'; break;
            case 6: return 'F'; break;
            case 7: return 'G'; break;
    
            // [ Mon Oct 04 14:19:01 BRT 2010 ] Comentário : Opção inválida
            default: return 'Opção inválida'; break;
        }
    }
    
    echo teste( 5 );
    
    ?>

  10. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    
    <script>
    var d = document;
    function $( bloco )
    {
        return d.getElementById( bloco );
    }
    
    function getItensSel()
    {
        itens = 0;
        var oElementos = d.getElementsByTagName('input');
        for( var i = 0; i < oElementos.length; i++ )
        {
            if( oElementos[ i ].type == 'checkbox' )
            {
               if( oElementos[ i ].checked )
               {
                  itens++;
               }
            }
        }
        
        $( 'total' ).innerHTML = itens;
    }
    </script>
    </head>
    <body onLoad="java script:getItensSel();">
    <table width="100%"  border="1" cellspacing="1" cellpadding="1">
      <tr>
        <td><input type="checkbox" name="checkbox" value="checkbox" onClick="getItensSel()"></td>
      </tr>
      <tr>
        <td><input type="checkbox" name="checkbox" value="checkbox" onClick="getItensSel()"></td>
      </tr>
      <tr>
        <td><input type="checkbox" name="checkbox" value="checkbox" onClick="getItensSel()"></td>
      </tr>
      <tr>
        <td><input type="checkbox" name="checkbox" value="checkbox" onClick="getItensSel()"></td>
      </tr>
      <tr>
        <td>
            Itens marcados <span id="total">0</span>
        </td>
      </tr>
    </table>
    </body>
    </html>

  11. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <title>Untitled Document</title>
    
    <script>
    
    function mudaCorItem( oObj ) 
    {
        var sCorAtual = oObj.style.backgroundColor;
        
        oObj.style.backgroundColor = ( sCorAtual == '#ffffff') ? '#f2f2f2' : '#ffffff';
    }
    
    function mudaCorCampo( oObj ) 
    {
        var sCorAtual = oObj.style.backgroundColor;
        
        oObj.style.backgroundColor = ( sCorAtual == '#ffffff') ? '#f2f2f2' : '#ffffff';
    }
    
    
    </script>
    
    
    </head>
    
    <body>
    <table width="100%"  border="1" cellspacing="1" cellpadding="1">
      <tr onClick="mudaCorItem(this);" style="background-color:#ffffff">
        <td width="15%">&nbsp;</td>
        <td width="85%"><input type="text" name="textfield" onClick="java script:mudaCorCampo(this);" style="background-color:#f2f2f2"></td>
      </tr>
      <tr onClick="mudaCorItem(this);" style="background-color:#ffffff">
        <td>&nbsp;</td>
        <td><input type="text" name="textfield" onClick="java script:mudaCorCampo(this);" style="background-color:#f2f2f2"></td>
      </tr>
    </table>
    </body>
    </html>

×
×
  • Criar Novo...