Ionic Digital Clock Java Script

I try to include a Digital Clock in my ionic app. I have the function digiClock.js in a separate Class.

$(document).ready(function() { // Create two variable with the names of the months and days in an array var monthNames = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; var dayNames = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] // Create a newDate() object var newDate = new Date(); // Extract the current date from Date object newDate.setDate(newDate.getDate()); // Output the day, date, month and year $('#Date').html(dayNames[newDate.getDay()] + ", " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ' ' + newDate.getFullYear()); setInterval(function() { // Create a newDate() object and extract the seconds of the current time on the visitor's var seconds = new Date().getSeconds(); // Add a leading zero to seconds value $("#sec").html((seconds < 10 ? "0" : "") + seconds); }, 1000); setInterval(function() { // Create a newDate() object and extract the minutes of the current time on the visitor's var minutes = new Date().getMinutes(); // Add a leading zero to the minutes value $("#min").html((minutes < 10 ? "0" : "") + minutes); }, 1000); setInterval(function() { // Create a newDate() object and extract the hours of the current time on the visitor's var hours = new Date().getHours(); // Add a leading zero to the hours value $("#hours").html((hours < 10 ? "0" : "") + hours); }, 1000); });

In my index.html I call digiClock.js so:

<script src="js/digiClock.js"></script> <div> <button class="clock" id="clockButton"> <div id="Date"></div> <ul> <li id="hours"></li> <li id="point">:</li> <li id="min"></li> <!-- <li id="point">:</li> --> <!-- <li id="sec"></li> --> </ul> </button>

But in my Digital Clock is not shown. What can be the reason? How can I call a seperate JS class in Ionic? What do I need to adjust in the class specifically for Ionic?

Thanks.

Category:javascript Time:2018-12-22 Views:2

Related post

  • how to refresh the asp.net Label every second automatically using Java script instead ajax? 2010-10-07

    how to refresh the asp.net Label every second automatically using Java script instead ajax? --------------Solutions------------- ajax is javascript in combination with a webrequest, so if you don't want to use ajax but only javascript the data has to

  • php digital clock for london zoon 2010-07-27

    How to create digital clock using PHP (london time zone) sample clock Am looking this sort of one clock, ther is a possible with ajax and php to we display similar of clock and date.. Thing is .it require too much of ajax,java script functions ------

  • How to parse 20 digit number using java script, jquery? 2010-06-22

    How to parse 20 digit number using java script, jquery?. --------------Solutions------------- A 20-digit number is generally too big for a Javascript native numeric type, so you'll need to find a "big number" package to use. Here's one that I've seen

  • Own digital clock with data und time. efficiently 2010-12-12

    Yesterday I programmed an own digital clock. I used the google blog: http://android-developers.blogspot.com/2007/11/stitch-in-time.html for help. The following code is the resulat. My question. Is it a efficient way, to update the handle by SystemClo

  • How to create a Digital Clock on Android? 2011-06-29

    I've been trying to write a simple Digital Clock app for Android. First I used the built in Digital Clock and tried to omit the seconds display, but I couldn't. I wanted clock's seconds to trigger some lines of code I have. Then I start to develop si

  • How would I be able to validate or format a location number 00-00-00-000-000 via Java-Script? 2011-07-28

    I have a question. How would I be able to validate or format a location number 00-00-00-000-000 digits 0-9 where 0 is via java-script. something like this function formatTime(time) { var result = false, m; var re = /^\s*([01]?\d|2[0-3]):?([0-5]\d)\s*

  • Creating digital clock using a thread 2012-01-20

    I am trying to create a digital clock using a Thread as this seems to me the logical way one would do it. I am not sure if I am going about it the right way but what I had in mind is to create the initial current System time using the JFrame construc

  • Validating text area in Java Script freezes all text areas 2014-04-09

    I have a Html page which uses Java Script and I am opening that page in WebView My problem is when I enabled max length validation on text area, then after validating text area all the text areas in page are freezed and I am not able to edit or delet

  • Java: Scripting language (macro) to embed into a Java desktop application 2008-09-27

    I am writing a graphics application in Java. Eventually I would like to build in a scripting language so things are programmable. Which language library do you recommend? Likely suspects are: Rhino (JavaScript) JRuby (Ruby) Jython (Python) Less likel

  • Java Script 2 D Arrays allocation 2008-10-06

    I want to allocate a 2 D Array in Java Script. I want do some thing similar to this in JavaScript typedef struct { int itemA, int itemB, string testC } myStruc; myStruct MyArray [100]; How to do this ? --------------Solutions------------- var arr = [

  • Decimal comaprison in Java script 2008-10-28

    I am trying to compare two decimal values in Java script. I have two objects as one assogned value "3" and the other as "3.00". When i say if (obj1 == obj2) it does not pass the condition as it is does the string comparision. I would instead want it

  • I want to get diff Controls Id through java script?? as any control can be added on form script will return the type of Control and its ID 2009-03-17

    I want to get diff Controls Id through java script??any control can be added by user on form java script will return the type of Control for ex textbox,label and its ID --------------Solutions------------- By controls, I'm assuming you mean form inpu

  • AJAX + dynamically adding java script function to the page 2009-03-27

    I am loading a portion of page using AJAX calls, which may contain script functions defined in them . Which are attached with the controls being loaded with different events. Now the problem is that when those events triggered i got the error "object

  • cross-browser standard Xml processing in Java Script 2009-06-27

    I am trying to figure out how to process XML in java script So i googled for it. The problem is , I don't know whether the tutorials I see will work only on IE. What is the "Standard" way to process Xml data in java script? Edit: Thanks for all your

  • How to use Java Script in Excel macros? 2009-08-25

    I am not a programmer and have a very very limited knowledge about both VB coding and Java scripting. I have a software which can be currently run through a Java script. The software does some caluculations and saves the result file in a folder. I ju

  • Event from JAva Script to objective c 2009-09-22

    I am developing a map application for iPhone.I am using google maps API to develop this,by adding the java script file to the resource.My problem is that I need to catch an event defined in the java script. for eg: I need to cath the following event

  • Java script alert msg in code behind Asp.net 3.5 2009-09-26

    How to use Java script alert msg in code behind? This message will be display after save the data. Here is my code, enter code here Protected Sub Add_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Add.Click 'add new class Dim DbCl

  • Enforcing browsing through a proxy - trhough a servlet, java script or custom application 2009-10-15

    We have a proxy server that implements a set of functions. I would like to be able to enforce browsing through this proxy without setting the proxy settings in the browser. This is for demonstrating purposes, without the need to enforce the demonstra

  • java script, XMLHttpRequest, permission denied within browser 2009-10-18

    my js file calls uses an xmlHttpRequest to display an rss feed. when i reference the java script within my html page, my browser renders an error: Permission denied. and therefore, my script is being blocked. i am not allowed to change the security s

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.444 (s). 13 q(s)