Saturday, December 24, 2016
switch case
用來取代else if超多的場合
雖然對電腦來說都一樣>.<
var moonPhase='full';
switch ( moonPhase) {
case 'full':
console.log('Howwwwlll!');
break;
case 'mostly full':
console.log('Arms and legs are getting hairier');
break;
case'mostly new':
console.log('Back on two feet.');
break;
default:
console.log('Invalid moon phase');
break;
}
if ...else....
var moonPhase='full';
var foggyNight=false;
if ( moonPhase=== 'full' || foggyNight) {
console.log('Howwwwlll!');
}else if (moonPhase==='mostly full'){
console.log('Arms and legs are getting hairier');
}else if (moonPhase==='mostly new') {
console.log('Back on two feet.');
} else {
console.log('Invalid moon phase');
}
Saturday, December 17, 2016
CSS files
body {
padding: 0;
margin: 0;
background: #f7f7f7;
/* Old browsers */
background: -moz-linear-gradient(45deg, #f7f7f7 0%, #EAE0D5 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(45deg, #f7f7f7 0%, #EAE0D5 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(45deg, #f7f7f7 0%, #EAE0D5 100%);
}
/** Header styles **/
.header {
background-image: url("https://s3.amazonaws.com/codecademy-content/courses/web-101/unit-4/htmlcss1-img_coffee-bgnd.jpeg");
height: 400px;
background-position: center center;
}
h1 {
font-family: 'Covered By Your Grace', sans-serif;
font-size: 100px;
line-height: 76px;
margin: 0;
position: relative;
text-align: center;
top: 20%;
color: rgb(3,150,100);
color: rgba(3,101,100,0.75);
}
/** List style **/
h2 {
color: #E4BB97;
font-family: 'Raleway', sans-serif;
font-size: 28px;
font-weight: 500;
text-align: left;
text-transform: uppercase;
background-color:#AA8EB5;
}
ul {
margin: 0 auto;
padding: 0;
width: 50%;
}
li {
border-bottom: 1px solid #E4BB97;
list-style: none;
margin: 100px 0px;
padding-bottom: 60px;
}
p {
color: #444444;
line-height: 32px;
font-family: 'Raleway', sans-serif;
font-size: 20px;
font-weight: 100;
}
a {
color: #214E34;
font-family: 'Raleway', sans-serif;
font-size: 13px;
font-weight: 900;
text-align: left;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 2px;
}
Thursday, December 15, 2016
First HTML
The Brown Bear
The brown bear (Ursus arctos) is native to parts of northern Eurasia and North America. Its conservation status is currently "Least Concern." There are many subspecies within the brown bear species, including the Atlas bear and the Himalayan brown bear.
Learn MoreThe following are subspecies of bears:
- Arctos
- Collarus
- Horribilis
- Nelsoni(extinct)
- Russia
- United States
- Canada
The following countries have the largest populations
of brown bears:
Tuesday, December 13, 2016
Form with Javascript
If you click submit, without filling out the text field,
your browser will display an error message.
Enter a number and click OK:
If the number is less than 100 or greater than 300, an error message will be displayed.
Monday, December 12, 2016
Sunday, December 11, 2016
Wednesday, December 07, 2016
Subscribe to:
Posts (Atom)