O'Reilly - JavaScript Application Cookbook by Jerry Bradenbaugh

O'Reilly - JavaScript Application Cookbook by Jerry Bradenbaugh

Author:Jerry Bradenbaugh [Bradenbaugh, Jerry]
Language: fra
Format: epub, pdf
Tags: Informatique
Publisher: O'Reilly
Published: 2003-03-22T03:33:05+00:00


only difference is that this function returns a string of links, not checkboxes or OPTION tags. The

"magic" happens in lines 37-45:

function genLinks(linkArr) {

var linkStr = '';

for (var i = 0; i < linkArr.length; i++) {

var linkParts = linkArr[i].split(',')

linkStr += '&nbsp; &nbsp; - <A HREF="' + linkParts[1] +

'"> ' +

linkParts[0] + '</A><BR>'

}

return linkStr;

}

genLinks() is designed to receive an array of delimited strings as its lone argument. The first

element of each is a string to display as link text. The second element is the URL for the HREF

attribute. Each of these is separated by a comma, so using the split() method by comma and

assigning the array result to local variable linkParts , we can get at the separate parts. The for loop iterates as usual, creating a string of links to return when finished.

7.5 Potential Extensions

Even a little bit of creativity can take you places with this application. Here are a few of the possibilities that come to mind:

• Add fields to manipulate table cell background colors and font colors, and other elements for the layout look.

• Allow users to choose entire page themes.

• Add a couple of extra text fields so that the user can add his or her own favorite web site links (with names).

• Post banner ads according to the user's cookie preferences.

7.5.1 More Choices for the Layout Look

Users like lots of choices. Anything you can tweak on the user's page can be manipulated. This

includes content and graphics in layers, other frames, and remote windows.

7.5.2 Adding Themes

This idea stems from Windows 95's desktop themes. Instead of letting users pick individual items, such as font face, size, and color, why not offer a couple of layout themes that make the choices all at once? Suppose you have a music-related web site. Consider the following select list:

<SELECT NAME="themes"onChange="swapImage('theImage',

this.options[this.selectedIndex].value);">

<OPTION VALUE="none">None

<OPTION VALUE="bigband">Big Band

<OPTION VALUE="rocknroll">Rock 'n Roll

<OPTION VALUE="rap">Rap



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Deep Learning with Python by François Chollet(12615)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7799)
Grails in Action by Glen Smith Peter Ledbrook(7712)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6433)
Kotlin in Action by Dmitry Jemerov(5080)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3904)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3343)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(3097)
Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos(2884)
The Art Of Deception by Kevin Mitnick(2619)
Drugs Unlimited by Mike Power(2476)
The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution by Walter Isaacson(2413)
A Blueprint for Production-Ready Web Applications: Leverage industry best practices to create complete web apps with Python, TypeScript, and AWS by Dr. Philip Jones(2350)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2317)
Writing for the Web: Creating Compelling Web Content Using Words, Pictures and Sound (Eva Spring's Library) by Lynda Felder(2271)
SEO 2018: Learn search engine optimization with smart internet marketing strategies by Adam Clarke(2199)
JavaScript by Example by S Dani Akash(2147)
DarkMarket by Misha Glenny(2091)
Wireless Hacking 101 by Karina Astudillo(2087)
Hands-On Cybersecurity with Blockchain by Rajneesh Gupta(2051)