Created
March 14, 2015 22:03
-
-
Save MattRyanCo/572d6a947034143426a3 to your computer and use it in GitHub Desktop.
First dynamic website eg with edity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function currentTime() { | |
var currentTime = new Date(); | |
var rhours, hours = currentTime.getHours(); | |
var minutes = currentTime.getMinutes(); | |
if (minutes < 10) { | |
minutes = "0" + minutes; | |
} | |
if (hours > 12) { | |
rhours = hours - 12; | |
} | |
var format = rhours + ":" + minutes; | |
if (hours > 11) { | |
format = format + " PM"; | |
} else { | |
format = format + " AM"; | |
} | |
return format; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<script language="javascript" type="text/javascript" src="code.js"></script> | |
<script> | |
var time = currentTime() | |
</script> | |
</head> | |
<body> | |
<h1>Hello World!</h1> | |
<h2>It is <script>document.write(time)</script></h2> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1 { | |
color: red; | |
} | |
h2 { | |
color: black; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment