Skip to main content

Posts

Showing posts with the label code

JavaScript Basic: Study Note For Array Iteration

Array iteration refers to iterating over a list or an array. Basically, it loops through that array and do something to each item or with each item. Use For Loop We use for loop to loop over an array. In order to do that, we need to make use of the array's length property. For example, if we want to print out each item from an array, we need to recall the index of each item. In this case, we want to print out each letter from the array, so we have to type the code for times. It is repeating a lot. Image we have hundred or thousands data and print it all out, it will drive us crazy. Therefore, we use a loop to help automate this process because what we are doing here is the same operation. Using for loop can save our time and make the code clean.  var letters = ["a", "b", "c", "d"] for(var i = 0; i < letters.length; i++) { console.log(color[i]); } In the for loop, we have our variable i start with 0 because that ...

Three Useful HTML Form Features: Radio Button, Drop-down Content & Data Validation

A simple register form like Facebook sign up form may only contains username, email and password. However, we may also see many complex forms out there such as survey form, visa application form, and school application form, etc. From Google Image Just like a random example form  above, this survey form not only has simple text fields such as "Name" & "Email" , but it also has drop-down content and checkbox to collect the information. With Drop-down and Checkbox, people feel easy to make a choice because they don't have to think their own answers. It also help company to collect the most relevant data and analyze results. How to add those useful features on your HTML form? Radio Button/Checkbox Radio Button and Checkbox are widgets whose state you can change by clicking on them. Both of them are created using the <input> element with its "type" attribute  set to the value "checkbox" or "radio" . ...

Three Most Common HTML Form Elements You Should Know

When I visited the Facebook page at the first time, it required me to sign up. Therefore, I completed the sign up form to create my new account. The form is very simple to fill in because it only asks for very common information such as full name, phone number, new password, birthday, and gender. It only took me one or two minutes to finish the form. Not only Social media sites require us to sign up first before we post anything, but many business or eCommerce sites also ask us to create new account before we take any action. For example, when I go to the Origins skin care site, it will pop up a email sign up form window. To encourage new customers to sign up, it gives a 15% off for the first order. It is definitely an attractive call-to-action message. Anyway, if your website requires users to sign up, you need to know how to create a HTML form. Yesterday, I just learned how to build a simple HTML form from Udemy course. And it is not that hard. All you need to kno...

Let's Create A Very Simple Web Page

Now we have learned the basic HTML elements and attributes. The first assignment from the course is to write a simple web page, which requires to include: Header, text, list, image, and hyperlink. Before we write any code, we need to know how to combine all the elements into an entire HTML page.  According to MDN Web Doc, it states that a HTML page must includes the following elements: <!DOCTYPE html> :  It is the shortest string of characters that counts as a valid doctype. <html></html> : This element wraps all the content on the entire page, and is sometimes known as the root element. <head></head> : This element acts as a container for all the stuff you want to include on the HTML page that  isn't  the content you are showing to your page's viewers. This includes things like keywords and a page description that you want to appear in search results. <meta charset="utf-8"> : This element sets the character set you...

Get Started to Learn HTML: Four Basic HTML Elements You Must Know

For the past two days, I had studied HTML from MDN Web Doc ,which is provided by Udemy course.  Before I started, I felt so excited and also  nerves . Can I really understand the content? What if the code language is too complex to understand?  Whatever......Not matter what, I told myself just start to learn. If I am too afraid to even open the web page , I would never figure it out. Try first, and then see what would happen.  As I read through the first part: Getting Started with HTML , I find it is not to difficult to understand the information. By following the instruction, I can start to write some basic HTML element in the test code box, and see the good result. At that moment, I feel so motivated. Now, I am going to share my study note and thought with you. What is HTML? According to MDN,  HTML is a markup language used to tell your browser how to structure the web pages to visit. Image you are building a house, HTML is like your...