...

View Full Version : talking clock for fire fox



this me
12-08-2006, 05:14 PM
this is a talking clock for IE but i want it to work with fire fox, any one knows how?

<html>
<head>
<title>Talking clock javascript example.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="talking clock, talking clock javascript, javascript, clock javascript, time interval, time spoken.">
<meta name="description" content="This is an example of the talking clock javascript. The time is spoken at a time interval of 10 seconds. You can set this to whatever time interval you like.">
</head>

<body bgcolor="#FFFFFF">
<script>

// Edit speaking interval (seconds)
var speakinginterval=10

// Do not edit the code below this line
var thistime= new Date()
var hours=thistime.getHours()
var minutes=thistime.getMinutes()
var ampm
speakinginterval=1000*speakinginterval

if (hours<12) {
ampm="am"
}
else if (hours>=12) {
ampm="pm"
if (hours!=12) {
hours=hours-12
}
}

function speakthetimeis() {
document.all.typesound.src="http://www.**************/games/soundfiles/the_time_is.wav"
var timer=setTimeout("speakhours()",1200)
}

function speakhours() {
document.all.typesound.src="http://www.**************/games/soundfiles/"+hours+".wav"
if (minutes<10) {
var timer=setTimeout("speakzerominutes()",1200)
}
else {
var timer=setTimeout("speakminutes()",1200)
}
}

function speakzerominutes() {
document.all.typesound.src="soundfiles/0.wav"
var timer=setTimeout("speakminutes()",600)
}

function speakminutes() {
document.all.typesound.src="http://www.**************/games/soundfiles/"+minutes+".wav"
var timer=setTimeout("speakampm()",1200)
}

function speakampm() {
document.all.typesound.src="http://www.**************/games/soundfiles/"+ampm+".wav"
thistime= new Date()
hours=thistime.getHours()
minutes=thistime.getMinutes()
if (hours<12) {
ampm="am"
}
else if (hours>=12) {
ampm="pm"
if (hours!=12) {
hours=hours-12
}
}
var content="<embed src=\"soundfiles/"+hours+".wav\" autostart=\"false\" hidden=\"true\">"
content+="<embed src=\"soundfiles/"+minutes+".wav\" autostart=\"false\" hidden=\"true\">"
soundcontainer.innerHTML=content
var timer=setTimeout("speakthetimeis()",speakinginterval)
}

if (document.all) {
document.write("<span id=\"soundcontainer\" style=\"position:relative;\">")
document.write("<embed src=\"soundfiles/"+hours+".wav\" autostart=\"false\" hidden=\"true\">")
document.write("<embed src=\"soundfiles/"+minutes+".wav\" autostart=\"false\" hidden=\"true\">")
document.write("<embed src=\"soundfiles/"+ampm+".wav\" autostart=\"false\" hidden=\"true\">")
document.write("</span>")
document.write("<embed src=\"soundfiles/0.wav\" autostart=\"false\" hidden=\"true\">")
document.write("</span>")
window.onload=speakthetimeis
}

</script> <embed src="http://www.**************/games/soundfiles/the_time_is.wav" autostart="false" hidden="true">
<bgsound id="typesound"> </embed>
</body>
</html>

cameronlanni
12-08-2006, 06:02 PM
Does Firefox give you an error, or does it simply not talk?

It is probably out of your control. Mozilla would have to patch their software themselves before a code like this would work.

Philip M
12-08-2006, 07:17 PM
document.all restricts the code to IE4+ (only)

Just for fun, try removing the references to document.all and see what happens when run in Firefox. But remember that in spite of the hype Firefox is only the latest incarnation of the awful Netscape browser.

this me
12-09-2006, 03:40 AM
there is no sound in FF, but i have another problem, and it specks only half of the minutes audio file, for EX. if it 5:35 pm, it say its five thirty...pm only without saying thirty five? any ideas. can i change the number in the minutes var from 600 to something else?

Arty Effem
12-09-2006, 11:50 AM
this is a talking clock for IE but i want it to work with fire fox, any one knows how?
Not a chance with that code, but under I.E. it displays tha activeX prompt for each sound that it plays. Are you saying that doesn't happen for you?

this me
12-09-2006, 05:21 PM
Not a chance with that code, but under I.E. it displays tha activeX prompt for each sound that it plays. Are you saying that doesn't happen for you?

i have this code in a toolbar, so you only hear the sound.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum