SóProvas


ID
606178
Banca
CESGRANRIO
Órgão
FINEP
Ano
2011
Provas
Disciplina
Programação
Assuntos

Como deve ser codificada uma página HTML que tem por objetivo exibir no browser do cliente, através de código JavaScript, a data e a hora corrente?

Alternativas
Comentários
  • Resposta correta é a letra "E"

    As outras respostas estão faltando elementos ou comtém elementos incorretos.

    Ex:

    a) <script lang=”javascript”> Errada pois não contém o atributo "lang" na tag script
    b) 
    Date(); largado dessa forma está totalmente incorreta, mesmo dentro de uma função não teria o resultado esperado.
    c-) 
    <language type=”javascript”> - Não existe essa tag
    d-) 
    <javascript> - o mesmo do ítem "c"
  • Fonte W3 Schools http://www.w3schools.com

    The <script> tag also supports the Global Attributes in HTML. The lang attribute specifies the language of the element's content.

    The type attribute specifies the MIME type of a script. The type attribute identifies the content between the <script> and </script> tags. The MIME type consists of two parts: one media type and one subtype. For JavaScript, the MIME type is "text/javascript".


    In the HTML DOM object model, the document object represents your web page. The document object is the owner of all other objects in your web page. If you want to access objects in an HTML page, you always start with accessing the document object.

    Changing HTML Elements

    Method: document.write(text)                  Description: Writing into the HTML output stream

  • e-

    document.write é uma instrução que manda escrever no HTML o texto como parametro. Em js, os comandos podem ou nao ser delimitados por ponto e virgula