Hola, soy nuevo en esto, hice una página que se supone que debería mostrar la fecha y hora al hacer click en el botón, pero no pasa nada. Disculpen mi ignorancia. Espero que alguien pueda ayudarme.
De antemano muchas gracias.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>index</title>
<link rel = "stylesheet"
type = "text/css"
href = "myStyle.css" />
<script type = "text/javascript" src = "javaScript.js"></script>
</head>
<body id = "principalDesign">
<div id = "all" class = "borde">
<button type = "button" id = "fecha" class = "borde">Mustra la fecha</button>
<div id = "date" class = "borde textAlign">
</div>
</div>
</body>
</html>
Aca está el javascript:
//<![CDATA[
<!--
function modifyText() {
var t2 = document.getElementById("date");
t2.innerHTML= Date();
}
// add event listener to t
function load() {
var el = document.getElementById("fecha");
el.addEventListener("click", modifyText, false);
}
document.addEventListener("DOMContentLoaded", load, false);
//-->
//]]>