dirtydinny
asked on
displaying date using HTML
Is there any way of displaying the current date (and even time if possible) using HTML ONLY. Also while i'm at it is there any way of getting text (is actually a link which i got rid of its automatic underline) to be underlinked when the user hyover over it. This also MUST BE HTML ONLY. It can't have ANT JAVASCRIPT of CSS. I know you can do both of those using javascript and css but these must be HTML only. thanks
dinny
dinny
Well,
Here is how you underline your links when someone HOVERS your links.
a:link{
background-color: transparent;
color: #ffffff;
text-decoration: none;
}
a:visited{
background-color: transparent;
color: #FFFFFF;
text-decoration: none;
}
a:hover{
background-color: transparent;
color: #000080;
text-decoration: underline;
}
a:active{
background-color: transparent;
color: #ffffff;
}
As far as i know you will have to use some sort of date script for your Date
Here is how you underline your links when someone HOVERS your links.
a:link{
background-color: transparent;
color: #ffffff;
text-decoration: none;
}
a:visited{
background-color: transparent;
color: #FFFFFF;
text-decoration: none;
}
a:hover{
background-color: transparent;
color: #000080;
text-decoration: underline;
}
a:active{
background-color: transparent;
color: #ffffff;
}
As far as i know you will have to use some sort of date script for your Date
And if you can`t use CSS
GO FIND ANOTHER WEB HOSTING COMPANY
GO FIND ANOTHER WEB HOSTING COMPANY
ASKER
ok where do i add that code?? in the anchor tag for that link?????????
ASKER
ok where do i add that code?? in the anchor tag for that link?????????
here is a complete example for the links
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a:link{
background-color: transparent;
color: red;
text-decoration: none;
}
a:visited{
background-color: transparent;
color: blue;
text-decoration: none;
}
a:hover{
background-color: transparent;
color: yellow;
text-decoration: underline;
}
a:active{
background-color: transparent;
color: green;
}
//-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><a href="http://cnn.com">Link 1</a></p>
<p><a href="https://www.experts-exchange.com">Link 2</a></p>
<p><a href="http://microsoft.com">Link 3</a></p>
</body>
</html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a:link{
background-color: transparent;
color: red;
text-decoration: none;
}
a:visited{
background-color: transparent;
color: blue;
text-decoration: none;
}
a:hover{
background-color: transparent;
color: yellow;
text-decoration: underline;
}
a:active{
background-color: transparent;
color: green;
}
//-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><a href="http://cnn.com">Link 1</a></p>
<p><a href="https://www.experts-exchange.com">Link 2</a></p>
<p><a href="http://microsoft.com">Link 3</a></p>
</body>
</html>
And here is a full example with the date script
========================== ========== ========== =
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a:link{
background-color: transparent;
color: red;
text-decoration: none;
}
a:visited{
background-color: transparent;
color: blue;
text-decoration: none;
}
a:hover{
background-color: transparent;
color: yellow;
text-decoration: underline;
}
a:active{
background-color: transparent;
color: green;
}
//-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><script type="text/javascript">
<!--
var d=new Date()
var weekday=new Array("Sunday","Monday","T uesday","W ednesday", "Thursday" ,"Friday", "Saturday" )
var monthname=new Array("Jan","Feb","Mar","A pr","May", "Jun","Jul ","Aug","S ep","Oct", "Nov","Dec ")
document.write(weekday[d.g etDay()] + " ")
document.write(d.getDate() + ". ")
document.write(monthname[d .getMonth( )] + " ")
document.write(d.getFullYe ar())
//-->
</script></p>
<p><a href="http://cnn.com">Link 1</a></p>
<p><a href="https://www.experts-exchange.com">Link 2</a></p>
<p><a href="http://microsoft.com">Link 3</a></p>
</body>
</html>
==========================
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a:link{
background-color: transparent;
color: red;
text-decoration: none;
}
a:visited{
background-color: transparent;
color: blue;
text-decoration: none;
}
a:hover{
background-color: transparent;
color: yellow;
text-decoration: underline;
}
a:active{
background-color: transparent;
color: green;
}
//-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><script type="text/javascript">
<!--
var d=new Date()
var weekday=new Array("Sunday","Monday","T
var monthname=new Array("Jan","Feb","Mar","A
document.write(weekday[d.g
document.write(d.getDate()
document.write(monthname[d
document.write(d.getFullYe
//-->
</script></p>
<p><a href="http://cnn.com">Link 1</a></p>
<p><a href="https://www.experts-exchange.com">Link 2</a></p>
<p><a href="http://microsoft.com">Link 3</a></p>
</body>
</html>
ASKER
hey thats cheating i said no CSS. How about displaying the date (and or time ) with Javascript. Keep the code as simple and as short as possible
ASKER
hey thats cheating i said no CSS. How about displaying the date (and or time ) with Javascript. Keep the code as simple and as short as possible
A short script to display the date :
<body>
<script>document.write(new Date().toLocaleString())</ script>
</body>
<body>
<script>document.write(new
</body>
This Does your Day, and Date
<script type="text/javascript">
<!--
var d=new Date()
var weekday=new Array("Sunday","Monday","T uesday","W ednesday", "Thursday" ,"Friday", "Saturday" )
var monthname=new Array("Jan","Feb","Mar","A pr","May", "Jun","Jul ","Aug","S ep","Oct", "Nov","Dec ")
document.write(weekday[d.g etDay()] + " ")
document.write(d.getDate() + ". ")
document.write(monthname[d .getMonth( )] + " ")
document.write(d.getFullYe ar())
//-->
</script>
And if you don`t want the links underlind at all you can do this
<a href="http://cnn.com" text-decoration:none>Link 1</a>
<script type="text/javascript">
<!--
var d=new Date()
var weekday=new Array("Sunday","Monday","T
var monthname=new Array("Jan","Feb","Mar","A
document.write(weekday[d.g
document.write(d.getDate()
document.write(monthname[d
document.write(d.getFullYe
//-->
</script>
And if you don`t want the links underlind at all you can do this
<a href="http://cnn.com" text-decoration:none>Link 1</a>
ASKER
hey thats cheating i said no CSS. How about displaying the date (and or time ) with Javascript. Keep the code as simple and as short as possible
Just out of curiosity why don't you want to use CSS and Javascript?
sorry avner i did not see you posted
ASKER
avner good code - i'll give you the points if you can get the date alone to appear. I think a static time on its own looks cheap. So a static date is good, consider i expect the code for a running clock to be tricky.
For a running time :
<html>
<head>
<title>abot:blank</title>
<script language="javascript1.2">
<!-- avcoh@yahoo.com
function setTime()
{
document.getElementById("t ime").inne rText = new Date().toLocaleString()
}
function init()
{
var oInter = window.setInterval("setTim e()",1000) ;
}
-->
</script>
<style>
</style>
</head>
<body onload="init()">
<div id="time"></div>
</body>
</html>
<html>
<head>
<title>abot:blank</title>
<script language="javascript1.2">
<!-- avcoh@yahoo.com
function setTime()
{
document.getElementById("t
}
function init()
{
var oInter = window.setInterval("setTim
}
-->
</script>
<style>
</style>
</head>
<body onload="init()">
<div id="time"></div>
</body>
</html>
ASKER
avner good code - i'll give you the points if you can get the date alone to appear. I think a static time on its own looks cheap. So a static date is good, consider i expect the code for a running clock to be tricky.
ASKER
avner good code - i'll give you the points if you can get the date alone to appear. I think a static time on its own looks cheap. So a static date is good, consider i expect the code for a running clock to be tricky.
dirtydinny
Please do not use the Refresh Button in your browser,
use the Reload This Question on the top left of this web page.
Please do not use the Refresh Button in your browser,
use the Reload This Question on the top left of this web page.
ASKER
avner good code - i'll give you the points if you can get the date alone to appear. I think a static time on its own looks cheap. So a static date is good, consider i expect the code for a running clock to be tricky.
Hi dirtydinny,
have no answers as they would be the same as above, but due to the time and effort put into the answers above how about bumping up the points - 20 is a miserable figure :)
have no answers as they would be the same as above, but due to the time and effort put into the answers above how about bumping up the points - 20 is a miserable figure :)
ASKER
ok if anyone has the code for the date alone ni'll give them all my points - 40points
ASKER
has anonye got the code for the date alone?????? i'll give anyone the points. THe reason why its only 20 is that alll i have!! sorry
dirtydinny , I have already posted the code for the date, anything else you need ?
ASKER
avner the code yuo gave was
<script>document.write(new Date().toLocaleString())<s cript>
this prints the time at the end of the date.
e.g 06 March 2003 11:53:33
all i want is 06 March 2003 - possible??
thanks
<script>document.write(new
this prints the time at the end of the date.
e.g 06 March 2003 11:53:33
all i want is 06 March 2003 - possible??
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The best I have is javascript as follows, It gives the date as "dd/mm/yy" but can be changed to suit your area.
<body>
<script>
var t = new Date();
var mm = t.getMonth()+1;
var dd = t.getDate();
var yy = t.getYear();
var d;
if (mm < 10) mm="0"+mm;
if (dd < 10) dd="0"+dd;
if (yy > 1899 && yy< 2000) yy=yy-1000;
if (yy > 1999 && yy< 3000) yy=yy-2000;
if (yy > 2999 && yy< 4000) yy=yy-3000;
if (yy<10) yy="0"+yy;
d = dd + "-" + mm + "-" + yy;
document.write(d);
</script>
</body>
<body>
<script>
var t = new Date();
var mm = t.getMonth()+1;
var dd = t.getDate();
var yy = t.getYear();
var d;
if (mm < 10) mm="0"+mm;
if (dd < 10) dd="0"+dd;
if (yy > 1899 && yy< 2000) yy=yy-1000;
if (yy > 1999 && yy< 3000) yy=yy-2000;
if (yy > 2999 && yy< 4000) yy=yy-3000;
if (yy<10) yy="0"+yy;
d = dd + "-" + mm + "-" + yy;
document.write(d);
</script>
</body>
HTML is static and you can not do what you are trying to do without Javascript or CSS .