Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Playing with .js

  • Loading branch information...
commit 3f227e684712a64bee9105fffc7a2788b2d2c6a4 1 parent dbe5302
@masviken authored
Showing with 48 additions and 52 deletions.
  1. +6 −1 index.html
  2. +22 −50 logic.js
  3. +20 −1 style.css
View
7 index.html
@@ -2,13 +2,17 @@
<html lang="en">
<head>
<title>Flowalist - the .js sandbox of @masviken</title>
- <style type="text/css"></style>
+ <style type="text/css" src="style.css"></style>
<script type="text/javascript" src="logic.js"></script>
</head>
<body>
+<!--
<h1>Flowalist</h1>
<div id="budgets">
<h2>Your budgets</h2>
+ <div class="button">
+ <p>Edit</p>
+ </div>
<ul>
<li></li>
<li></li>
@@ -21,5 +25,6 @@
<li></li>
</ul>
</div>
+ -->
</body>
</html>
View
72 logic.js
@@ -1,51 +1,23 @@
-// Do a couple of console.logs
-console.log("Hello from myscript.js");
-console.log("Hello again!"); // This is not needed
+var payday = new Date();
+payday.setFullYear(2012,4,25);
+var today = new Date();
+var msLeft = payday - today;
+var oneDay = 1000 * 60 * 60 * 24;
+var daysLeft = msLeft / oneDay;
+var weeksLeft = daysLeft / 7;
+
+var balance = 4200;
+var dayBudget = Math.round(balance / daysLeft);
+
+function transaction () {
+ var amount = prompt("How much did you spend?");
+ var sum = (balance - amount);
+ document.write("You have " + Math.round((balance - amount) / daysLeft) + " kr left to spend today.");
+};
+
+var budget = {
+ day: Math.round((balance - transaction) / daysLeft) + " kr",
+ week: Math.round((balance - transaction) / weeksLeft) + " kr",
+ month: balance + " kr"
+};
-/*
-var name = prompt("What is your name?");
-alert("Hello " + name);
-
-name = "Nick";
-console.log("The users's name is " + name);
-*/
-
-
-/*console.log("Before");
-
-var name = prompt("What is your name");
-
-if ("Tomas") {
- console.log("If block");
-} else {
- console.log("Else block");
-}
-
-console.log("After");*/
-
-/*
-var counter = 10;
-
-while (counter) {
- console.log("Hello world");
- console.log("Hi");
- counter = counter - 1;
-}
-
-while (prompt("What is your name?")) {
- console.log ("Got your name")
-}
-
-console.log("Before")
-
-for (var counter=10; counter; counter = counter -1) {
- console.log("Hello world", counter)
-}
-
-console.log("After");
-*/
-
-var friends = ["Nick", "Michael", "Amit", "Tomas";
-console.log(friends);
-console.log(friends.length);
-console.log(friends[1]);
View
21 style.css
@@ -1,3 +1,9 @@
+body {}
+
+h1 logo {
+ background-image: url(#);
+}
+
@font-face {
font-family: 'LeagueGothicRegular';
src: url('League_Gothic-webfont.eot');
@@ -8,4 +14,17 @@
font-weight: normal;
font-style: normal;
-}
+}
+
+h2 {
+ font-family: "LeagueGothicRegular", sans-serif;
+}
+
+a {
+ text-decoration: none;
+}
+
+ul li {
+ list-style: none;
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.