XWidgetSoft Forum
https://www.bbs.xwidget.com/

Display +/- hour with jv
https://www.bbs.xwidget.com/viewtopic.php?f=8&t=6755
Page 1 of 1

Author:  Jimking [ July 12th, 2017, 7:39 am ]
Post subject:  Display +/- hour with jv

I have 3 txts and I would like to visualize the current hour (middle txt), hour -1 for the left txt and hour +1 for the right one.
Something like this screenshot, where the 10 is the current hour, the left is hour-1=9 and the right hour+1=11

How can I reproduce it with java script...?
I attach a simple demo widget

Attachments:
testhours.xwp [5.97 KiB]
Downloaded 769 times
test.png
test.png [ 49.27 KiB | Viewed 15790 times ]

Author:  Jimking [ July 12th, 2017, 10:27 am ]
Post subject:  Re: Display +/- hour with jv

Code:
var hr;

// function to update the time

function updateTime() {
//initialise the time function
var time = new Date();

//returns the date/time in a string format
hr = time.getHours();
hr = hr + 1;
}


in main.xul

<cores>
<dateTimeCore name="clockTimer" onUpdate="updateTime"/>
</cores>

yereverluvinuncleber, I added your script but I need to assign the texts.. :?

Author:  yereverluvinuncleber [ July 12th, 2017, 10:48 am ]
Post subject:  Re: Display +/- hour with jv

There you go Jim.

Attachments:
testhours.xwp [6.28 KiB]
Downloaded 739 times

Author:  Jimking [ July 12th, 2017, 12:14 pm ]
Post subject:  Re: Display +/- hour with jv

Thanks Dean..! Let me try it :)

Author:  yereverluvinuncleber [ July 12th, 2017, 12:54 pm ]
Post subject:  Re: Display +/- hour with jv

You'll have to add the minus side yourself but it'll be easy enough to do so. You have a serious need for some javascript skills. As I suggested in my DA note to you, I'm willing to give you a little tuition.

Author:  Jimking [ July 12th, 2017, 3:01 pm ]
Post subject:  Re: Display +/- hour with jv

Thanks again Dean. Check my reply on DA..

Author:  yereverluvinuncleber [ July 19th, 2017, 7:44 am ]
Post subject:  Re: Display +/- hour with jv

How did you get on Jim?

Author:  Jimking [ July 19th, 2017, 1:30 pm ]
Post subject:  Re: Display +/- hour with jv

All ok Dean! Thanks again for your help.
I used your script here:

http://jimking.deviantart.com/art/Son-O ... -692249411

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/