Pular para o conteúdo principal

Questão de TI - Desenvolvimento de Sistemas — HTML — FGV 2023

TI - Desenvolvimento de SistemasHTML
Código
fg161164
Banca
FGV
Órgão
Pref Niterói
Ano
2023
Cargo
Ana ( )
Considere uma página Web que exibe somente um botão. Quando essa página é carregada, ou o botão é clicado, a data corrente é exibida.   O trecho de um script que implementa corretamente essa lógica é:
  1. A<html> <body> <button onclick, onload="XPTO()">Clique aqui...</button> <script> function XPTO() {alert();} </script> </body> </html>
  2. B<html> <body> <button onclick="XPTO()">Clique aqui...</button> <script> function XPTO() {alert(Date());} </script> </body> </html>
  3. C<html> <body> <button onload, onclick="XPTO()">Clique aqui...</button> <script> function onload XPTO() {alert();} </script> </body> </html>
  4. D<html> <body onload="XPTO()"> <button onclick="XPTO()">Clique aqui...</button> <script> function XPTO() {alert(Date());} </script> </body> </html>
  5. E<html> <body onload="XPTO()" <button onclick="XPTO()">Clique aqui...</button> > <script> function onload XPTO(Date()) {} </script> </body> </html>
Revelar gabarito e comentário

GabaritoD — <html> <body onload="XPTO()"> <button onclick="XPTO()">Clique aqui...</button> <script> function XPTO() {alert(Date());} </script> </body> </html>

Link permanente: /questoes/fg161164