Javascript add different text to each minute of hour
Topics related to client-side programming language.
Post questions and answers about JavaScript, Ajax, or jQuery codes and scripts.
-
JanMolendijk
- Posts: 267
- Location: Holland Rotterdam
Javascript add different text to each minute of hour
Hello Coursesweb I`m unknown with javascripts ????
I would like to add function minutes to this script
on each minute an diferent text added to the hour
Hope you can help me out....
Code: Select all
<SCRIPT>
day = new Date()
hr = day.getHours()
if (hr == 1) document.write("<font face='Verdana' color='blue' size='5'>After one .... not yet to bed?</font>")
if (hr == 2) document.write("<font face='Verdana' color='blue' size='5'>After two.... Wouldn`t you even go to sleep?</font>")
</SCRIPT>
Admin
Hello,
Try the following script.
Code: Select all
<div id='addtxtmin' style='color:#00d; font-size:20px; font-weight:700'></div>
<script>
const txt_min =[
'After one .... not yet to bed?',
'After two.... Wouldn`t you even go to sleep?',
'Minute 3',
'Minute 4',
'Minute 5'
];
var addtxtmin = document.getElementById('addtxtmin');
function addTxtMin() {
var ddate=new Date()
var min = ddate.getMinutes();
var txt = txt_min[min] ? txt_min[min] : 'Default text: Minute '+ min;
addtxtmin.innerHTML = txt;
setTimeout('addTxtMin()',60000);
}
addTxtMin();
</script>
Similar Topics
-
Hour and Minutes togheter in Javascript
JavaScript - jQuery - Ajax
First post
Dear Coursesweb I can not find out how to add the hours + minutes togheter.
<SCRIPT LANGUAGE= JavaScript >
day = new Date()
hr =...
Last post
See and use the following example:
<script>
var day = new Date();
let hr = day.getHours();
let mn = day.getMinutes();
let se =...
-
Display message to every minute in Javascript
JavaScript - jQuery - Ajax
First post
Hello,
On eatch minute from the current hour I wanna have an message
I can not find out how to complete
I hope to get something like this (code...
Last post
If you only want to display a message to every minute, just use the setInterval() function. It calls a function repeatedly, over and over again, at...
-
How to get text from javascript alert box
JavaScript - jQuery - Ajax
First post
Good evening (dutch-time) I have a javascript what can copy text to a clip-board + it has a button to show the item-list in a alert-box.
But can`t...
Last post
Thanks for the support I tried already things with history + f_print
also studied those a little before I asked coursesweb but I shall
when my head...
-
One Minute Wisdom
Spirituality
First post
One Minute Wisdom is a book written by Anthony de Mello with various anecdotes and short religious and spiritual stories.
- You can download and...
Last post
Attachment
- I have no idea of what tomorrow will bring, so I wish to prepare for it.
- You fear tomorrow; --not realizing that yesterday is just...
-
Link inline with the text
HTML - CSS
First post
Hi members I'm looking for the script for a link <href> to another URL.
I give part of my text and the link as it is now on my page:
and...
Last post
Hello,
In your case, put both the text and the link inside the <p> tag.
<p>and there where useful, supplemented with comments, tips...