<html>
<head>
<title>Часики графические</title>
<script language="JavaScript">
<!--
document.write(setClock())
function setClock() {
var text = ""
var openImage = "<IMG SRC=\"" + getPath(location.href) + "../img/dg"
var closeImage = ".gif\" HEIGHT=21 WIDTH=16>"
var now = new Date()
var hour = now.getHours()
var minute = now.getMinutes()
now = null
var ampm = ""
if (hour >= 12) {
hour -= 12
ampm = "pm"
} else
ampm = "am"
hour = (hour == 0) ? 12 : hour
if (minute < 10)
minute = "0" + minute
// do not parse this number!
minute += ""
hour += ""
for (var i = 0; i < hour.length; ++i) {
text += openImage + hour.charAt(i) + closeImage
}
text += openImage + "c.gif\" HEIGHT=21 WIDTH=9>"
for (var i = 0; i < minute.length; ++i) {
text += openImage + minute.charAt(i) + closeImage
}
text += openImage + ampm + closeImage
return text}function getPath(url) {
lastSlash = url.lastIndexOf("/")
return url.substring(0, lastSlash + 1)}
// --></script>
</body>
</html>
Часики графические
Страница: 1
Сообщений 1 страница 2 из 2
Поделиться12008-06-12 16:28:41
Поделиться22008-06-12 16:32:51
Код:
<html> <head> <title>Часики графические</title> <script language="JavaScript"> <!-- document.write(setClock()) function setClock() { var text = "" var openImage = "<IMG SRC=\"" + getPath(location.href) + "../img/dg" var closeImage = ".gif\" HEIGHT=21 WIDTH=16>" var now = new Date() var hour = now.getHours() var minute = now.getMinutes() now = null var ampm = "" if (hour >= 12) { hour -= 12 ampm = "pm" } else ampm = "am" hour = (hour == 0) ? 12 : hour if (minute < 10) minute = "0" + minute // do not parse this number! minute += "" hour += "" for (var i = 0; i < hour.length; ++i) { text += openImage + hour.charAt(i) + closeImage } text += openImage + "c.gif\" HEIGHT=21 WIDTH=9>" for (var i = 0; i < minute.length; ++i) { text += openImage + minute.charAt(i) + closeImage } text += openImage + ampm + closeImage return text}function getPath(url) { lastSlash = url.lastIndexOf("/") return url.substring(0, lastSlash + 1)} // --></script> </body> </html>
Страница: 1