| | |
trying to place live date & Time in web page
Please support our Site Layout and Usability advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Ok, I have two questions. based on the codes below where do I disable or turn on/off the time display.
Question (2) there is a line that say //change font size here
what is the format or javascript language to change the font size please give an example:
Question (2) there is a line that say //change font size here
what is the format or javascript language to change the font size please give an example:
html Syntax (Toggle Plain Text)
<html> <head> <script type='text/javascript'> <!-- /* Live Date Script- © Dynamic Drive ([url]www.dynamicdrive.com[/url]) For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use, visit [url]http://www.dynamicdrive.com[/url] */ var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") function getthedate(){ var mydate=new Date() var year=mydate.getYear() if (year < 1000) year+=1900 var day=mydate.getDay() var month=mydate.getMonth() var daym=mydate.getDate() if (daym<10) daym="0"+daym var hours=mydate.getHours() var minutes=mydate.getMinutes() var seconds=mydate.getSeconds() var dn="AM" if (hours> =12) {dn="PM"} if (hours>12){ hours=hours-12 } if (hours==0) { hours=12 } if (minutes<=9) { minutes="0"+minutes } if (seconds<=9) { seconds="0"+seconds } //change font size here var cdate="<small> <font color='000000' face='Arial'> <b> "+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn +"</b> </font> </small> " if (document.all) document.all.clock.innerHTML=cdate else if (document.getElementById) document.getElementById("clock").innerHTML=cdate else document.write(cdate) } if (!document.all&&!document.getElementById) getthedate() function goforit(){ if (document.all||document.getElementById) setInterval("getthedate()",1000) } --> </script> </head> <body onLoad="goforit()"> <span id="clock"></span><!-- the span at left goes exactly where you want the clock --> </body> </html>
Last edited by peter_budo; May 24th, 2009 at 3:57 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
StarDustEngineer
an old, form of html gives font sizes as <small><large> etc
directly below the //change font size you will see the code includes <small>some text </small> to set font size.
The script is old, and though it works it doesnt take advantage of recent developments.
the line
is the one that contains the strings for what is displayed
-copy it -comment it
and you can mess with the copy as much as you need to get the display as you wish
and still retain a backup of all the fields
directly below the //change font size you will see the code includes <small>some text </small> to set font size.
The script is old, and though it works it doesnt take advantage of recent developments.
the line
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn +"</b></font></small>"
is the one that contains the strings for what is displayed
-copy it -comment it
and you can mess with the copy as much as you need to get the display as you wish
javascript Syntax (Toggle Plain Text)
//commented out //var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn +"</b></font></small>" var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</b></font></small>"
Last edited by almostbob; May 21st, 2009 at 9:13 am.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
almostbob how can I take advantage of recent developments.
would it look something like this
here is the original
would it look something like this
var cdate="<style="font-size:150% font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</b></font></small>"
here is the original
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</b></font></small>"
Last edited by peter_budo; May 24th, 2009 at 3:58 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
StarDustEngineer
<body onLoad="goforit()"><script>
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='0000FF' face='Tahoma'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
</script>
<span id="clock"></span>
</body> Last edited by sreein1986; May 23rd, 2009 at 3:56 am.
Thanx,
Shiriyal
http://shiriyal.blogspot.com/
if you problem solved add me as a reputation and mark it mark as solved
Shiriyal
http://shiriyal.blogspot.com/
if you problem solved add me as a reputation and mark it mark as solved
![]() |
Similar Threads
- retrieve date from database to display on web page (PHP)
- print a letter in a web page (JavaScript / DHTML / AJAX)
- Display client's PC Date & Time (ASP.NET)
- Access Date & Time Validation Question (MS Access and FileMaker Pro)
- Opening a Web Page in a New Window (Windows tips 'n' tweaks)
Other Threads in the Site Layout and Usability Forum
- Previous Thread: About CMS and a website
- Next Thread: Great Place for free templates and other resources.
| Thread Tools | Search this Thread |
blogging content customer design development dreamweaver duplicate email evaluation filesharing firefox flash gilbane google html itunes javascript kazaa layout music napster peertopeer photoshop remote remoteserver satellitenavigation satnav server site tables template tips tomtom url wave web website websitedesignreview web_development web_sites






