Week 12: Lab #23
DUE: Thursday, 4/6 @ 5pm
Upload your completed lab by the due date specified above and make sure that you add a working link to it on your class page, otherwise it will not be reviewed and you will not receive credit.
- For this assignment you're going to create parallel arrays to store website links. This will include arrays for each of the following:
- Name of link.
- Name of website.
- Link URL.
- Link category (sports, business, etc).
- Keywords (list of words/terms associated with the link content).
You are creating a link look-up page that will be able to:
- Contain parallel arrays for each of the above. Enter at least 20 bookmarks. Try to have a relatively diverse assortment of links. Feel free to simply use websites you like.
- Your basic page should have an intro and title, and then a search box where the user can type in any word to search through your links. All of the above content should be in a div that is centered on the page.
- When the search button is pressed:
- Loop over all of the arrays looking for matches. Each link that has a match should output that link to the page. You should not use a break command, as you want all matching links. But you want all of your array searches to be in one if statement (using OR (||) connectors in between them). Your if statement will use indexOf() to find matches.
- If the user left the box empty, then loop through all of the links and create entries for every link by adding to the innerHTML of the link div. You can use any internal formatting you want (ordered list, unordered list, individual lines with breaks, etc).
- Any links that are generated by either of the above should build anchor tags around the links (they should be clickable links, not just text).