Windows 10: Learning JavaScript

Discus and support Learning JavaScript in Windows 10 Software and Apps to solve the problem; I have an idea for a script I'd like to write, but I know virtually nothing about JavaScript except that I would need to use that language for my... Discussion in 'Windows 10 Software and Apps' started by jayv2251, Jul 22, 2017.

  1. jayv2251 Win User

    Learning JavaScript


    I have an idea for a script I'd like to write, but I know virtually nothing about JavaScript except that I would need to use that language for my application. I have some script writing background but I'm very rusty. Last time I did any scripting was in Bash for Linux over 10 years ago. Before that I was writing programs in Basic for my high school's Commodore Pet and 64's.

    What I'm trying to do is no big secret at all. I'm looking to make a time clock appear on a website once I load it. This time clock would allow me to "punch in" to start a day, "punch out" for lunch, coffee break, or what ever reason I wanted it to pause. Once break is over, punch back in, then a final punch out for the day. I've spend the last hour or more googling to see if I could find a "beginner's" guide that would show a very basic clock like this. Yes there's clocks, and I'm starting to get the gist of the lingo, but none of them allow the start, stop, start, stop that I not only want...I NEED!

    :)
     
    jayv2251, Jul 22, 2017
    #1

  2. Since mango, why cant I "find" anymore in IE on windows phone 7??

    Many thanks for that! A rather nifty piece of Javascript there!!



    I didnt know you can paste Javascript into the address? How bizzare! Why?! YOu learn something everyday.



    Very helpful thankyou.
     
    Soft Techy, Jul 22, 2017
    #2
  3. Nokia Browser 7.1.35

    Not working properly it shows please enable the javascript but javascripts is olready on what to do now
     
    Haroon91711, Jul 22, 2017
    #3
  4. axe0 New Member

    Learning JavaScript

    Hi jayv2251,

    I have a script that does something like this originally written for a WBS project. The only issue being that I wrote this script for multiple timers. I never paid enough attention to get it 100% working though.

    Here is the script, I'm aware that there may be lots of bugs and may also be a bit improperly written.
    Code: var curHour; var curMin; var curSec; var time = { totalSec: 0, start: function(id){ var self = this; self.id = id; var totalWorked; self.totalWorked = $('#Do' + self.id).text().split(':'); this.interval = setInterval(function(){ console.log($('#Do' + self.id).text().split(':')); self.totalSec += 1; curHour = Math.floor(self.totalWorked[0] + (self.totalSec / 3600)) ; curMin = Math.floor(self.totalWorked[1] + (self.totalSec / 60 % 60)); curSec = Math.floor(self.totalWorked[2] + (self.totalSec % 60)); if(curHour <= "9") curHour = '0' + curHour; if(curMin <= "9") curMin = '0' + curMin; if(curSec <= "9") curSec = '0' + curSec; $('#Do' + self.id).text(curHour + ':' + curMin + ':' + curSec); }, 1000); }, pause: function(){ clearInterval(this.interval); delete this.interval; }, resume: function(id){ if(typeof this.interval == 'undefined') this.start(id); } }; function startTimer(id){ time.start(id); var pauseBtn = $('<button type=button class="btn btn-primary btn-pause" value='+id+' id=pause'+id+' onclick=pauseTime('+id+');>pause tijd</button>'); $('#startTime' + id).replaceWith(pauseBtn); } function pauseTime(id){ time.pause(); var resumeBtn = $('<button type=button class="btn btn-primary" id=resume'+id+' value='+id+' onclick=resumeTime('+id+');>resume tijd</button>'); $('#pause' + id).replaceWith(resumeBtn); $.ajax({ url: 'http://localhost/wbs/public/saveTime.php', type: "post", dataType: 'text', data: {"id": id, "time": $('#Do' + id).text()}, success: function(){location.reload();}, error: function(xhr, textStatus, errorThrown){ console.log('Error code: ' + errorThrown); } }); } function resumeTime(id){ time.resume(id); var pauseBtn = $('<button type=button class="btn btn-primary" id=pause'+id+' value='+id+' onclick=pauseTime('+id+');>pause tijd</button>'); $('#resume' + id).replaceWith(pauseBtn); } totalSec = 0;[/quote]
     
  5. pyramid10 Win User
    pyramid10, Apr 5, 2018
    #5
Thema:

Learning JavaScript

Loading...
  1. Learning JavaScript - Similar Threads - Learning JavaScript

  2. Activate Windows 10 for learning

    in Windows 10 Gaming
    Activate Windows 10 for learning: Why should I still pay $140 for Windows 10 Home OS if it's end of life? Also, the older PC I'm using for learning purposes will not work w/ 11 as originally stated by Microsoft, plus I'm unemployed at this time. At least a severely discounted rate please, or I'll be forced to...
  3. Activate Windows 10 for learning

    in Windows 10 Software and Apps
    Activate Windows 10 for learning: Why should I still pay $140 for Windows 10 Home OS if it's end of life? Also, the older PC I'm using for learning purposes will not work w/ 11 as originally stated by Microsoft, plus I'm unemployed at this time. At least a severely discounted rate please, or I'll be forced to...
  4. Activate Windows 10 for learning

    in Windows 10 Updates and Activation
    Activate Windows 10 for learning: Why should I still pay $140 for Windows 10 Home OS if it's end of life? Also, the older PC I'm using for learning purposes will not work w/ 11 as originally stated by Microsoft, plus I'm unemployed at this time. At least a severely discounted rate please, or I'll be forced to...
  5. Learn Microsoft login not working [Possible Solution]

    in Windows 10 Software and Apps
    Learn Microsoft login not working [Possible Solution]: I want to address an issue I have seen for years now and a lot of folk having issues with login into Learn Microsoft. Logging into Microsoft itself is not an issue but as soon as you reach the "Learn" site you are logged out and every time you try to login you get redirected...
  6. Learn Microsoft login not working [Possible Solution]

    in Windows 10 Gaming
    Learn Microsoft login not working [Possible Solution]: I want to address an issue I have seen for years now and a lot of folk having issues with login into Learn Microsoft. Logging into Microsoft itself is not an issue but as soon as you reach the "Learn" site you are logged out and every time you try to login you get redirected...
  7. Learn about this picture

    in Windows 10 Gaming
    Learn about this picture: Love the backgrounds that microsoft provides however, it has a very annoying caveat. Without pattern or expected routine, "learn about this picture" will open the title of the photograph, give the option to praise or berate, and offer the "learn more" option. It's a nuisance...
  8. Learn about this picture

    in Windows 10 Software and Apps
    Learn about this picture: Love the backgrounds that microsoft provides however, it has a very annoying caveat. Without pattern or expected routine, "learn about this picture" will open the title of the photograph, give the option to praise or berate, and offer the "learn more" option. It's a nuisance...
  9. How do I remove "Learn about this picture" Icon without disabling Windows spotlight?

    in Windows 10 Gaming
    How do I remove "Learn about this picture" Icon without disabling Windows spotlight?: I appreciate the dynamic rotation of backgrounds from Windows Spotlight, however the icon "Learn about this picture" is getting annoying, because hovering my mouse above it which often happens by accident while manipulating other windows opens a small window that often gets...
  10. How do I remove "Learn about this picture" Icon without disabling Windows spotlight?

    in Windows 10 Software and Apps
    How do I remove "Learn about this picture" Icon without disabling Windows spotlight?: I appreciate the dynamic rotation of backgrounds from Windows Spotlight, however the icon "Learn about this picture" is getting annoying, because hovering my mouse above it which often happens by accident while manipulating other windows opens a small window that often gets...