Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Challenges/Week2/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,28 @@
//Call function

//Alert user results
var $correct = false;
alert("Greetings friend!");

var $input = function(){
$guess = 0;
while(!$correct){
$userInput = prompt("We sincerely request your valuable input: ");
$response = "HELLO";
if($userInput.toUpperCase() == $response){
alert($userInput + " World");
$correct = true;
console.log("Guess:" + $guess);
} else{
alert("Sorry, that is not the valuable input we were hoping for:");
var $tryAgain = prompt("Would you like to quit: yes or no?");
$guess++;
if($tryAgain.toUpperCase() == 'NO' || $tryAgain.toUpperCase() == 'N' ){
break;
}
}
}
return $guess;
}

$input();
2 changes: 1 addition & 1 deletion Challenges/Week2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ <h2>My first code challenge!</h2>
<li>Don't forget to call your script file from this HTML file! I've created the script tags for you, but you have to add something to it!
</ol>

<script></script>
<script src="app.js"></script>
</body>
</html>
43 changes: 43 additions & 0 deletions Challenges/Week6/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
body{
margin-top: 10em;
text-align: center;
font-family: Lato;
}
.box{
height: 100px;
width:100px;
border: solid 2px black;
margin: auto;
text-align: center;
margin-bottom: 1.5em;
transform-style: preserve-3d;
position: relative;
}

.btn-group a {
display:inline-block;
}
.btn-group{

}

.form-control{
width: 200px;
margin: auto;
margin-bottom: 1.5em;
}

ul{
list-style: none;
}


.print.btn, #printResults{
width:200px;
}

#printResults{
border:solid 1px lightgrey;
text-align: left;
font-family: Lato;
}
88 changes: 40 additions & 48 deletions Challenges/Week6/index.html
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
<title>Box</title>
</head>
<body>
<div class="header">

<h3>Code Challenge:</h3>
<p>
Create an object named "Box" with 3 properties, height, width, volume.</br>
Create 2 buttons for Height. The first button decreases the Box Height by 1. The second button increases the Box Height by 1.</br>
Create a button that prints the object and its attributes to the page (use the span "output".</br>
</p>

<h3>Extra credit</h3>
<p>Create interactive buttons to decrease or increase the Width and Volume</p>
<head>
<meta charset="utf-8">
<title>J Marsh | Week6</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="box"></div>
</div>
<div class="col-lg-3">
<select name="dimension" class=" form-control selectpicker">
<option>Dimensions</option>
<option>Height</option>
<option>Width</option>
<option>Volume</option>
</select>


</div>

<table>
<tr>
<td>Box:</td>
<td><span id="output"></span>
<td><button id="Print" class="btn">Print Box</button></td>
</tr>
<tr>
<td>Height:</td>
<td><button id="HeightDecrease" class="btn">-</button></td>
<td><button id="HeightIncrease" class="btn">+</button></td>
</tr>
<tr>
<td>Weight:</td>
<td><button id="WeightDecrease" class="btn">-</button></td>
<td><button id="WeightIncrease" class="btn">+</button></td>
</tr>
<tr>
<td>Volume:</td>
<td><button id="VolumeDecrease" class="btn">-</button></td>
<td><button id="VolumeIncrease" class="btn">+</button></td>
</tr>
</table>


<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>

</body>
</html>
<div class="btn-group col-lg-off-set-6" role="group" aria-label="...">
<div class="minus btn btn-lg btn-danger"><span class="glyphicon glyphicon-minus"></span></div>
<div class="add btn btn-lg btn-success"><span class="glyphicon glyphicon-plus"></span></div>
</div>
</div>
<div>
<div class="col-lg-2">
<div class="print btn btn-lg btn-default"><span>Print Results</span></div>
<div id="printResults"></div>
</div>
</div>
</div>
</div>

<!-- JavaScripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js" integrity="sha384-I6F5OKECLVtK/BL+8iSLDEHowSAfUo76ZL9+kGAgTRdiByINKJaqTPH/QVNS1VDb" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="js/app.js"></script>
</body>
</html>
51 changes: 51 additions & 0 deletions Challenges/Week6/indexOLD.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
<title>Box</title>
</head>
<body>
<div class="header">

<h3>Code Challenge:</h3>
<p>
Create an object named "Box" with 3 properties, height, width, volume.</br>
Create 2 buttons for Height. The first button decreases the Box Height by 1. The second button increases the Box Height by 1.</br>
Create a button that prints the object and its attributes to the page (use the span "output".</br>
</p>

<h3>Extra credit</h3>
<p>Create interactive buttons to decrease or increase the Width and Volume</p>


</div>

<table>
<tr>
<td>Box:</td>
<td><span id="output"></span>
<td><button id="Print" class="btn">Print Box</button></td>
</tr>
<tr>
<td>Height:</td>
<td><button id="HeightDecrease" class="btn">-</button></td>
<td><button id="HeightIncrease" class="btn">+</button></td>
</tr>
<tr>
<td>Weight:</td>
<td><button id="WeightDecrease" class="btn">-</button></td>
<td><button id="WeightIncrease" class="btn">+</button></td>
</tr>
<tr>
<td>Volume:</td>
<td><button id="VolumeDecrease" class="btn">-</button></td>
<td><button id="VolumeIncrease" class="btn">+</button></td>
</tr>
</table>


<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>

</body>
</html>
67 changes: 66 additions & 1 deletion Challenges/Week6/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,69 @@
//Create a button that prints the object and its attributes to the page (use the span "output".

//Extra credit
//Create interactive buttons to decrease or increase the Width and Volume
//Create interactive buttons to decrease or increase the Width and Volume

var box = {
height:1,
width:1,
volume:1,
};
$('select').on('change', function() {
if($('select[name="dimension"]').val() == 'Width'){
$('.add').click(function(){
box.width +=1;
console.log(box.width);
var boxWidth = box.width*10+100;
$('.box').css("width", boxWidth);
$('#printResults').css('display', 'none');
});

$('.minus').click(function(){
box.width -=1;
console.log(box.width);
var boxWidth = box.width*10 +100;
$('.box').css("width", boxWidth);
$('#printResults').css('display', 'none');
});

}
if($('select[name="dimension"]').val() == 'Height'){
$('.add').click(function(){
box.height +=1;
console.log(box.height);
var boxHeight = box.height*10+100;
$('.box').css("height", boxHeight);
$('#printResults').css('display', 'none');
});
$('.minus').click(function(){
box.height -=1;
console.log(box.height);
var boxHeight = box.height*10 +100;
$('.box').css("height", boxHeight);
$('#printResults').css('display', 'none');
});
}
if($('select[name="dimension"]').val() == 'Volume'){
$('.add').click(function(){
box.volume +=1;
$('#printResults').css('display', 'none');
});
$('.minus').click(function(){
box.volume -=1;
$('#printResults').css('display', 'none');
});
}
});

$('.print').click(function(){
$results = "<ul>";
$results += "<li>Height: " + box.height + " in.</li>";
$results += "<li>Width: " + box.width + " in.</li>";
$results += "<li>Volume: " + box.volume + " in.</li>";
$results += "</ul>";

document.getElementById("printResults").innerHTML = $results;
$('#printResults').css('display', 'block');

});

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# FSJS-Weekly-Challenges
Weekly challenges for FullStack JavaScript students
J Marsh's Weekly challenges for FullStack JavaScript students

Weekly challenges will be posted in this repo. You can fork the repo to your own GitHub and continue to pull the latest, merge with your solutions, and commit back to your own GitHub.

Expand Down
11 changes: 11 additions & 0 deletions Week2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Try and do all of the following. Don't worry if you can't complete everything or have difficulty getting started. We'll walk through this in class next week!

-Prompt the user for input and store that into a variable

-Pass that value into a function

-If the user entered 'Hello' into the prompt, alert the user with 'Hello World!'

-If they entered anything else, alert with a different message of your choice (such as "Incorrect input!"

-Don't forget to call your script file from this HTML file! I've created the script tags for you, but you have to add something to it!
25 changes: 25 additions & 0 deletions Week2/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//create function
//control and return statements

//Prompt user for input and store variable

//Call function

//Alert user results
var $correct = false;
alert("Greetings friend!");

while(!$correct){
$userInput = prompt("We sincerely request your valuable input: ");
$response = "HELLO";
if($userInput.toUpperCase() == $response){
alert($userInput + " World");
$correct = true;
} else{
alert("Sorry, that is not the valuable input we were hoping for:");
var $tryAgain = prompt("Would you like to try again: yes or no?");
if($tryAgain.toUpperCase() == 'NO' || $tryAgain.toUpperCase() == 'N' ){
break;
}
}
}
20 changes: 20 additions & 0 deletions Week2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<head>
<title>Week 2 Code Challenge</title>
</head>
<body>
<div class="main-content">
<h2>My first code challenge!</h2>
</div>
<p>Try and do all of the following:</p>
<ol>
<li>Prompt the user for input and store that into a variable</li>
<li>Pass that value into a function</li>
<li>If the user entered 'Hello' into the prompt, alert the user with 'Hello World!'</li>
<li>If they entered anything else, alert with a different message
<li>Don't forget to call your script file from this HTML file! I've created the script tags for you, but you have to add something to it!
</ol>

<script src="app.js"></script>
</body>
</html>