PDA

View Full Version : Joining multiple HTML 'widgets'


shifanyroma
07-15-2009, 02:30 AM
Hi everyone, this is my first post after trawling the internets for hours for an answer!

I have two codes, one for a small clock and the other for the date.

CLOCK
Code:

<object width="65" height="65"><param name="movie" value="http://www.csalim.com/clocks/399591.swf"><embed src="http://www.csalim.com/clocks/399591.swf" width="65" height="65"></embed></object>

DATE
Code:

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<div style="color:WHITE;">
<style type="text/css">
#container {
width:150px;
padding:1em;
margin:auto;
}
#day,#date {
font-family:verdana,arial,helvetica,sans-serif;
font-size:1em;
}
</style>

<script type="text/javascript">
if(window.addEventListener){
window.addEventListener('load',showDate,false);
}
else {
if(window.attachEvent){
window.attachEvent('onload',showDate);
}
}

function showDate() {

months=['January','February','March','April','May','June', 'July',
'August','September','October','November','Decembe r'];

days=['Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday'];

now=new Date();
yy=now.getUTCFullYear();
mm=now.getUTCMonth();
dt=now.getDate();
dd=now.getUTCDay();

end='th.';
if((dt==1)||(dt==21)||(dt==31)) {
end='st.';
}
if((dt==2)||(dt==22)) {
end='nd.';
}
if((dt==3)||(dt==23)) {
end='rd.';
}
document.getElementById('day').firstChild.nodeValu e=days[dd]+' '+dt+end;
document.getElementById('date').firstChild.nodeVal ue=months[mm]+', '+yy;
}
</script>

</head>
<body>

<div id="container">
<div id="day">&nbsp;</div>
<div id="date">&nbsp;</div>
</div>

</body>
</html>

Together, they look like this: