Start with Python
This commit is contained in:
8
2- javascript/9-get-primes/README.md
Normal file
8
2- javascript/9-get-primes/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
Get Prime Numbers Challenge
|
||||
===========================
|
||||
|
||||
In the HTML file you'll find the normal template plus an input form.
|
||||
|
||||
Have the input form accept a number from the user. When the form is submitted, have the function getPrimes take the number as an argument (num) and calculate all the prime numbers up to and including num.
|
||||
|
||||
In typical fashion, use JQuery to have all the prime numbers append to the "#printout" div. Make sure they are wrapped in p tags for readability. Do not modify the HTML in any way.
|
22
2- javascript/9-get-primes/index.html
Normal file
22
2- javascript/9-get-primes/index.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!doctype HTML>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="reset.css">
|
||||
<link rel="stylesheet" type="text/css" href="main.css">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class = "container">
|
||||
<nav id="top">
|
||||
<h1>Get All Prime Numbers below Input Number</h1>
|
||||
</nav>
|
||||
<form id="numberform" action="#" method="post">
|
||||
<input type="text" id= "number" name="comment" placeholder="Enter a Number">
|
||||
<input type="submit" value="Get Primes">
|
||||
</form>
|
||||
<div id = "printout"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
41
2- javascript/9-get-primes/main.css
Normal file
41
2- javascript/9-get-primes/main.css
Normal file
@ -0,0 +1,41 @@
|
||||
body{
|
||||
background-color: #D1D1D1
|
||||
}
|
||||
|
||||
nav{
|
||||
position: absolute;
|
||||
background-color: black;
|
||||
width: 100%;
|
||||
height: 4em;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
line-height: 4em;
|
||||
}
|
||||
|
||||
nav h1{
|
||||
font-size: 3em;
|
||||
font-family: monospace;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#numberform{
|
||||
margin: 5em auto 0 auto;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
#printout{
|
||||
width: 800px;
|
||||
min-height: 1000px;
|
||||
background-color: white;
|
||||
margin: 1em auto 0 auto;
|
||||
color: black;
|
||||
text-indent: 1em;
|
||||
}
|
||||
|
||||
#printout p{
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#printout p:nth-child(even) {
|
||||
background-color: #D1D1D1;
|
||||
}
|
11
2- javascript/9-get-primes/main.js
Normal file
11
2- javascript/9-get-primes/main.js
Normal file
@ -0,0 +1,11 @@
|
||||
// use this function to get and return all the prime numbers below the input number
|
||||
function getPrimes(num){
|
||||
|
||||
}
|
||||
|
||||
// all jquery dom actions can only be called inside document ready.
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
})
|
47
2- javascript/9-get-primes/reset.css
Normal file
47
2- javascript/9-get-primes/reset.css
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
|
||||
* http://cssreset.com
|
||||
*/
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
Reference in New Issue
Block a user