Discussion Forums  >  Uncategorized

Replies: 11    Views: 1069

ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
06/19/11 04:50 AM (14 years ago)

Html timer code offline use

Wondering if this html timer code can be implemented for offline use? it works on custom html screen but not in html doc screen...custom html doc screens won't do this type of stuff...correct? sorry if not explaining right, still pretty new to playing with code...thanks everyone hope you weekend is great! <html> <head> <title></title> <style type=text/css> .timeClass { font-family:arial,verdana,helvetica,sans-serif; font-weight:bold; font-size:60pt; } </style> <script> var sec = 04; // set the seconds var min = 0; // set the minutes function countDown() { sec--; if (sec == -01) { sec = 59; min = min - 1; } else { min = min; } if (sec<=9) { sec = 0 + sec; } time = (min<=9 ? 0 + min : min) + min and + sec + sec ; if (document.getElementById) { theTime.innerHTML = time; } SD=window.setTimeout(countDown();, 1000); if (min == '00' && sec == '00') { sec = 00; window.clearTimeout(SD); } } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(function() { countDown(); }); </script> </head> <body text=#FFFFFF> </body> </html>
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
06/19/11 03:35 PM (14 years ago)
Glad to report i got it sorted out, if anyone is interested in the countdown timer code i used leave your email...cheers!! Anyone know if i can play a sound along with the alert message that pops up when timer is done? he Html code i am using is different than above by the way...thanks!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
06/20/11 03:39 AM (14 years ago)
a) Custom HTML Docs can implement javacscript. See the sample.html file and the sample.js javascript file in the BT_Docs folder. Sounds are little tricky but totally doable. Imagine having an embed (google embed tag) object in the HTML that was created dynamically with javascript. When it was created it could play a sound from the project sound folder. Fun even thinking about it... Psuedo code may be... onClick = document.getElementById('my html container').innerHTML = 'new embed markeup with audio reference'; For sure that's a hack job but experiment with that idea in a real browser with a real HTML page and see what you can come up with. Put test.hml and test.mp3 in a folder on your desktop and start hacking away. The sound in the same folder as the doc simulates how it will be in the app.
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
06/20/11 12:53 PM (14 years ago)
Still don't understand why same HTML code works in Custom HTML but not in HTML Doc screens( i have dragged the html file into Xcode project) ... would like these html/javascript documents to be used offline if possible...searching forum but don't see quite what i'm looking for....Thanks again for your time
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
06/20/11 10:36 PM (14 years ago)
Hi Dave, problem was i was writing the Html with rich text commands on in TextEdit...once i made it plain text and saved as html it works great offline...little snag causing such problems!
 
kylewestern
Code is Art
Profile
Posts: 2
Reg: Oct 27, 2011
New York
20
like
11/30/11 02:29 AM (14 years ago)
Hey Ian, A little late, but if the offer still stands, I would love to check out the code you used for the countdown timer. Thanks, Kyle [email protected]
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
11/30/11 11:10 AM (14 years ago)
@kylewestern, u got mail :) let me know if u need more help
 
Rad Doc
Apple Fan
Profile
Posts: 653
Reg: Oct 08, 2010
USA, NYC
8,580
like
12/22/11 04:10 AM (14 years ago)
Ian, can you share your timer code. Would like to play with it to see if I can get it to count up. [email protected]
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
02/10/12 03:30 PM (14 years ago)
I'd love a copy of the code of available.... [email protected] Cheers!
 
mataleon
Lost but trying
Profile
Posts: 1
Reg: Feb 18, 2012
Athens
10
like
02/27/12 11:18 AM (13 years ago)
can I have it also? even its an old thread thnx in advance [email protected]
 
HB
I hate code!
Profile
Posts: 2
Reg: Apr 06, 2011
NYC
20
like
05/08/12 02:15 PM (13 years ago)
Hey Ian, can I have the code too? Any success with the sound? Thanks [email protected]
 
HB
I hate code!
Profile
Posts: 2
Reg: Apr 06, 2011
NYC
20
like
05/08/12 02:23 PM (13 years ago)
Hey Ian, can I have the code too? Any success with the sound? Thanks [email protected]
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.