Arquivo: fale-conosco.html

<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tudo sobre o Google Glass</title>
    <link rel="stylesheet" href="_css/estilo.css">
    <link rel="stylesheet" href="_css/form.css">
    <script src="_javascript/funcoes.js"></script>
    <script>
        function calc_total() {
            var qtd = parseInt(document.getElementById('cQtd').value);
            tot = qtd * 1500;
            document.getElementById('cTot').value = tot;
        }
    </script>
</head>

<body>
    <div id="interface">
        
        <header id="cabecalho">
            <hgroup>
                <h1>Google Glass</h1>
                <h2>A revolução do Google está chegando</h2>
            </hgroup>
    
            <img id="icone" src="/curso-html5-pacote01/projeto-glass-html5/
            _imagens/contato.png" alt="oculos preto do google glass">
            <nav id="menu">
                <h1>Menu Principal</h1>
                <ul type="disc">   
                    <li onmouseover="mudaFoto('_imagens/home.png')" 
                    onmouseout="mudaFoto('_imagens/contato.png')">
                        <a href="index.html">Home</a>
                    </li>
                    <li onmouseover="mudaFoto('_imagens/especificacoes.png')" 
                    onmouseout="mudaFoto('_imagens/contato.png')">
                        <a href="specs.html">Especificações</a>
                    </li>
                    <li onmouseover="mudaFoto('_imagens/fotos.png')" 
                    onmouseout="mudaFoto('_imagens/contato.png')">
                        <a href="fotos.html">Fotos</a>
                    </li>
                    <li onmouseover="mudaFoto('_imagens/multimidia.png')" 
                    onmouseout="mudaFoto('_imagens/contato.png')">
                        <a href="multimidia.html">Multimídia</a>
                    </li>
                    <li onmouseover="mudaFoto('_imagens/contato.png')" 
                    onmouseout="mudaFoto('_imagens/contato.png')">
                        <a href="fale-conosco.html">Fale conosco</a>
                    </li>
                </ul>
            </nav>
        </header>

        <section id="corpo-full">
            <article id="noticia-principal">
                <header id="cabecalho-artigo">
                    <hgroup>
                        <h3>Fale Conosco > Contato</h3>
                        <h1>Formulário de Contato</h1>
                        <h2>por Gustavo Guanabara</h2>
                        <h3 class="direita">Atualizado em 01/Maio/2013</h3>
                    </hgroup>
                </header>

                <form method="post" id="fContato" action="<mailto:contato@cursoemvideo>.
                com" oninput="calc_total();">
                    <fieldset id="usuario">
                        <legend>Identificação do Usuário</legend>
                        <p><label for="cNome">Nome:</label><input type="text" 
                        name="tNome" id="cNome" size="20" maxlength="30" 
                        placeholder="Nome Completo"></p>
                        <p><label for="cSenha">Senha:</label><input type="password" 
                        name="tSenha" id="cSenha" size="8" maxlength="8" 
                        placeholder="8 dígitos"></p>
                        <p><label for="cMail">E-mail:</label><input type="email" 
                        name="tMail" id="cMail" size="20" maxlength="40"></p>
                            <fieldset id="sexo"><legend>Sexo</legend>
                            <input type="radio" name="tSexo" id="cMasc" 
                            checked><label for="cMasc">Masculino</label><br/>
                            <input type="radio" name="tSexo" id="cFem"><label 
                            for="cFem">Feminino</label></fieldset>
                        <p><label for="cNasc">Data de Nascimento:</label><input 
                        type="date" name="tNasc" id="cNasc"></p>
                    </fieldset>

                    <fieldset id="endereco">
                        <legend>Endereço do Usuário</legend>
                        <p><label for="cRua">Logradouro:</label><input type="text" 
                        name="tRua" id="cRua" size="13" maxlength="80" 
                        placeholder="Rua, Av, Trav, ..."></p>
                        <p><label for="cNum">Número:</label><input type="number" 
                        name="tNum" id="cNum" min="0" max="99999"></p>
                        <p><label for="cEst">Estado:</label><select name="tEst" 
                        id="cEst">
                            <optgroup label="Região Sudeste">
                                <option value="RJ">Rio de Janeiro</option>
                                <option value="SP" selected>São Paulo</option>
                                <option value="MG">Minas Gerais</option>
                            </optgroup>

                            <optgroup label="Região Sul">
                                <option value="PR">Paraná</option>
                                <option value="SC">Santa Catarina</option>
                                <option value="RS">Rio Grnade do Sul</option>
                            </optgroup>
                        </select>
                    </p>
                        <p><label for="cCid">Cidade:</label><input type="text" 
                        name="tCid" id="cCid" maxlength="40" size="20" 
                        placeholder="Sua Cidade" list="cidades">
                        </p>
                        <datalist id="cidades">
                            <option value="Rio de Janeiro"></option>
                            <option value="Nova Iguaçu"></option>
                            <option value="Niterói"></option>
                            <option value="Belford Roxo"></option>
                        </datalist>
                    </fieldset>

                    <fieldset id="mensagem">
                        <legend>Mensagem do Usuário</legend>
                        <p><label for="cUrg">Grau de Urgência:</label>
                        Mín<input type="range" name="tUrg" id="cUrg" min="0" max="10" 
                        step="2">Máx</p>
                        <p><label for="cMsg">Mensagem:</label>
                        <textarea name="tMsg" id="cMsg" cols="35" rows="5" 
                        placeholder="Deixe aqui sua mensagem"></textarea></p>
                    </fieldset>

                    <fieldset id="pedido">
                        <legend>Quero um Google Glass</legend><p>
                            <input type="checkbox" name="tPed" id="cPed" checked>
                            <label for="cPed">Gostaria de adquirir um Google Glass 
                            quando disponível</label></p>
                        <p><label for="cCor">Cor:</label>
                            <input type="color" name="tCor" id="cCor" 
                            value="#0000FF"></p>
                        <p><label for="cQtd">Quantidade:</label>
                        <input type="number" name="tQtd" id="cQtd" min="0" max="5" 
                        value="0"></p>
                        <p><label for="cTot">Preço Total: R$</label>
                        <input type="text" name="tTot" id="cTot" 
                        placeholder="Total a Pagar" readonly></p>
                    </fieldset>

                    <input type="image" name="tEnviar" src="_imagens/botao-enviar.png">
                </form>
            </article>
        </section>

            <footer id="rodape">
                <p>Copyright &copy; 2013 - by Gustavo Guanabara <br> 
                <a href="<https://facebook.com/cursosemvideo>" target="_blank">Facebook
                </a> | <a href="<https://twitter.com/cursosemvideo>" target="_blank">
                Twitter</a></p>
            </footer>
        </div>
    </body>
</html>

<form method=”post”> : especifica como enviar os dados do formulário do navegador para o servidor web.

<form action=”mailto:”> : Quando você usa mailto: como valor do atributo action, o navegador abre o cliente de email padrão do usuário com um novo email preparado. O endereço de email após mailto: é preenchido no campo “Para” do email.

Por exemplo, se você tem <form action="mailto:[email protected]">, quando o usuário submeter o formulário, seu cliente de email será aberto com um novo email cujo destinatário é “[email protected]”.

<form oninput=”calc_total();”> : O atributo oninput é um atributo de evento global em HTML que é acionado sempre que o valor de um elemento <input><select> ou <textarea> é alterado pelo usuário.

Quando você usa oninput="calc_total()" em um elemento de formulário, a função JavaScript calc_total() é chamada toda vez que o usuário altera o valor desse elemento de formulário.

<input type=”checkbox”> : é usado para criar uma caixa de seleção, que permite ao usuário selecionar várias opções de um conjunto.

Arquivo: form.css

@charset "UTF-8";

form {
    width: 500px;
    margin: auto;
}

input, textarea {
    font-family: sans-serif;
    font-weight: normal;
    font-size: 13pt;
    background-color: rgba(255, 255, 255, .8);
}

input:hover, textarea:hover {
    background-color: #dddddd;
}

legend {
    color: #888888;
    font-weight: bold;
    font-size: 13pt;
    font-family: sans-serif;
}

fieldset {
    border-color: #cecece;
    margin: 20px;
}

fieldset#sexo {
    width: 150px;
}

fieldset#usuario {
    background: url(../_imagens/icone-contato.png) no-repeat 95% 95%;
}

fieldset#endereco {
    background: url(../_imagens/icone-endereco.png) no-repeat 95% 95%;
}

fieldset#mensagem {
    background: url(../_imagens/icone-mensagem.png) no-repeat 95% 95%;
}

fieldset#pedido {
    background: url(../_imagens/icone-pagamento.png) no-repeat 95% 95%;
}