Archive for July, 2007

CD-41Chapter 6 .Programming Fundamentals, Part I A case (Yahoo web hosting)

Friday, July 27th, 2007

CD-41Chapter 6 .Programming Fundamentals, Part I A case in point is adding numbers that may be in the form of text strings. In a simple arithmetic statement that adds two numbers together, you get the expected result: 3 + 3 // result = 6 But if one of those numbers is a string, JavaScript leans toward converting the other value to a string thus turning the plus sign s action from arithmetic addition to joining strings. Therefore, in the statement 3 + 3 // result = 33 the string-ness of the second value prevails over the entire operation. The first value is automatically converted to a string, and the result joins the two strings. Try this yourself in The Evaluator Jr. If I take this progression one step further, look what happens when another number is added to the statement: 3 + 3 + 3 // result = 63 This might seem totally illogical, but there is logic behind this result. The expression is evaluated from left to right. The first plus operation works on two numbers, yielding a value of 6. But as the 6 is about to be added to the 3, JavaScript lets the string-ness of the 3 rule. The 6 is converted to a string, and two string values are joined to yield 63. Most of your concern about data types will focus on performing math operations like the ones here. However, some object methods also require one or more parameters of particular data types. While JavaScript provides numerous ways to convert data from one type to another, it is appropriate at this stage of the tutorial to introduce you to the two most common data conversions: string to number and number to string. Converting strings to numbers As you saw in the last section, if a numeric value is stored as a string as it is when entered into a form text field your scripts will have difficulty applying that value to a math operation. The JavaScript language provides two built-in functions to convert string representations of numbers to true numbers: parseInt() and parseFloat(). There is a difference between integers and floating-point numbers in JavaScript. Integers are always whole numbers, with no decimal point or numbers to the right of a decimal. Floating-point numbers, on the other hand, can have fractional values to the right of the decimal. By and large, JavaScript math operations don t differentiate between integers and floating-point numbers: A number is a number. The only time you need to be cognizant of the difference is when a method parameter requires an integer because it can t handle fractional values. For example, parameters to the scroll() method of a window require integer values of the number of pixels vertically and horizontally you want to scroll the window. That s because you can t scroll a window a fraction of a pixel on the screen. To use either of these conversion functions, insert the string value you wish to convert as a parameter to the function. For example, look at the results of two different string values when passed through the parseInt()function: parseInt( 42 ) // result = 42 parseInt( 42.33 ) // result = 42
We recommend high quality webhost to host and run your jsp application: christian web host services.

CD-40 Part II . JavaScript Tutorial Testing Evaluation (Web site templates)

Thursday, July 26th, 2007

CD-40 Part II . JavaScript Tutorial Testing Evaluation in Navigator You can begin experimenting with the way JavaScript evaluates expressions with the help of The Evaluator Jr. (seen in the following figure), an HTML page you can find on the companion CD-ROM. (I introduce the Senior version in Chapter 13.) Enter any JavaScript expression into the top text box, and either press Enter/Return or click the Evaluate button. The Evaluator Jr. has 26 variables (lowercase a through z) predefined for you. Therefore, you can assign values to variables, test comparison operators, and even do math here. Using the age variable examples from earlier in this chapter, type each of the following statements into the upper text box and observe how each expression evaluates in the Results field. Be sure to observe case-sensitivity in your entries. a = 45 a b = a - 15 b a - b a > b To start over, click the Refresh/Reload button. Data Type Conversions I mentioned earlier that the type of data in an expression can trip up some script operations if the expected components of the operation are not of the right type. JavaScript tries its best to perform internal conversions to head off such problems, but JavaScript cannot read your mind. If your intentions differ from the way JavaScript treats the values, you won t get the results you expect.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

CD-39Chapter 6 .Programming Fundamentals, Part I The (Web hosting directory) variable,

Thursday, July 26th, 2007

CD-39Chapter 6 .Programming Fundamentals, Part I The variable, yourAge, evaluates to 30 the next time the script uses it. If the myAge value changes later in the script, the change has no link to the yourAge variable because myAge evaluated to 45 when it was used to assign a value to yourAge. Expressions in script1.htm You probably didn t recognize it at the time, but you saw how expression evaluation came in handy in your first script of Chapter 3. Recall the second document.write() statement: document.write( of + navigator.appName + . ) The document.write() method (remember, JavaScript uses the term method to mean command) requires a parameter in parentheses: the text string to be displayed on the Web page. The parameter here consists of one expression that joins three distinct strings: of navigator.appName . The plus symbol is one of JavaScript s ways of joining strings. Before JavaScript can display this line, it must perform some quick evaluations. The first evaluation is the value of the navigator.appName property. This property evaluates to a string of the name of your browser. With that expression safely evaluated to a string, JavaScript can finish the job of joining the three strings in the final evaluation. That evaluated string expression is what ultimately appears on the Web page. Expressions and variables As one more demonstration of the flexibility that expression evaluation offers, this section shows you a slightly different route to the document.write()statement. Rather than join those strings as the direct parameter to the document.write() method, I can gather the strings in a variable and then apply the variable to the document.write()method. Here s how that method looks, as I simultaneously declare a new variable and assign it a value: var textToWrite = of + navigator.appName + . document.write(textToWrite) This method works because the variable, textToWrite, evaluates to the combined string. The document.write()method accepts that string value and does its display job. As you read a script or try to work through a bug, pay special attention to how each expression (variable, statement, object property) evaluates. I guarantee that as you learn JavaScript (or any language), you will end up scratching your head from time to time because you haven t stopped to examine how expressions evaluate when a particular kind of value is required in a script.
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

CD-38 Part II . JavaScript Tutorial To complicate (Sri lanka web server)

Wednesday, July 25th, 2007

CD-38 Part II . JavaScript Tutorial To complicate matters, a variable name cannot contain space characters. Therefore, one-word variable names are fine. Should your description really benefit from more than one word, you can use one of two conventions to join multiple words as one. One convention is to place an underscore character between the words; the other is to start the combination word with a lowercase letter and capi talize the first letter of each subsequent word within the name I refer to this as the interCap format. Both of the following examples are valid variable names: my_age myAge My preference is for the second version. I find it easier to type as I write JavaScript code and easier to read later. In fact, because of the potential conflict with future keywords, using multiword combinations for variable names is a good idea. Multiword combinations are less likely to appear in the reserved word list. Variable names have a couple of other important restrictions. Avoid all punctua tion symbols except for the underscore character. Also, the first character of a vari able name cannot be a numeral. If these restrictions sound familiar, it s because they re identical to those for HTML element identifiers described in Chapter 5. Expressions and Evaluation Another concept closely related to the value and variable is expression evalua tion perhaps the most important concept of learning how to program a computer. We use expressions in our everyday language. Remember the theme song of The Beverly Hillbillies? Then one day he was shootin at some food And up through the ground came a-bubblin crude Oil that is. Black gold. Texas tea. At the end of the song, you find four quite different references ( crude, oil, black gold, and Texas tea ). They all mean oil. They re all expressions for oil. Say any one of them and other people know what you mean. In our minds, we evaluate those expressions to mean one thing: oil. In programming, a variable always evaluates to its contents, or value. For example, after assigning a value to a variable, such as var myAge = 45 anytime the variable is used in a statement, its value (45) is automatically applied to whatever operation that statement calls. Therefore, if you re 15 years my junior, I can assign a value to a variable representing your age based on the evalu ated value of myAge: var yourAge = myAge - 15
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

Graphic web design - CD-37Chapter 6 .Programming Fundamentals, Part I for, say,

Wednesday, July 25th, 2007

CD-37Chapter 6 .Programming Fundamentals, Part I for, say, some addition. Although the innards of a program have that level of complexity, programming languages such as JavaScript shield you from it. The most convenient way to work with data in a script is to first assign the data to a variable. It s usually easier to think of a variable as a basket that holds information. How long the variable holds the information depends on a number of factors. But the instant a Web page clears the window (or frame), any variables it knows about are immediately discarded. Creating a variable You have a couple of ways to create a variable in JavaScript, but one covers you properly in all cases. Use the varkeyword, followed by the name you want to give that variable. Therefore, to declare a new variable called myAge, the JavaScript statement is var myAge That statement lets the browser know that you can use that variable later to hold information or to modify any of the data in that variable. To assign a value to a variable, use one of the assignment operators. The most common one by far is the equal sign. If I want to assign a value to the myAge variable at the same time I declare it (a combined process known as initializing the variable), I use that operator in the same statement as the varkeyword: var myAge = 45 On the other hand, if I declare a variable in one statement and later want to assign a value to it, the sequence of statements is var myAge myAge = 45 Use the varkeyword only for declaration or initialization once for the life of any variable name in a document. A JavaScript variable can hold any value type. Unlike many other languages, you don t have to tell JavaScript during variable declaration what type of value the variable will hold. In fact, the value type of a variable can change during the execution of a program. (This flexibility drives experienced programmers crazy because they re accustomed to assigning both a data type and a value to a variable.) Variable names Choose the names you assign to variables with care. You ll often find scripts that use vague variable names, such as single letters. Other than a few specific times where using letters is a common practice (for example, using ias a counting variable in repeat loops in Chapter 7), I recommend using names that truly describe a variable s contents. This practice can help you follow the state of your data through a long series of statements or jumps, especially for complex scripts. A number of restrictions help instill good practice in assigning names. First, you cannot use any reserved keyword as a variable name. That includes all keywords currently used by the language and all others held in reserve for future versions of JavaScript. The designers of JavaScript, however, cannot foresee every keyword that the language may need in the future. By using the kind of single words that currently appear in the list of reserved keywords (see Appendix B), you always run a risk of a future conflict.
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

CD-36 Part II . JavaScript Tutorial a value. (Cool web site)

Tuesday, July 24th, 2007

CD-36 Part II . JavaScript Tutorial a value. Outside of programming, the term value usually connotes a number of some kind; in the programming world, however, the term is not as restrictive. A string of letters is a value. A number is a value. The setting of a check box (whether it is checked or not) is a value. In JavaScript, a value can be one of several types. Table 6-1 lists JavaScript s formal data types, with examples of the values you will see displayed from time to time. Table 6-1 JavaScript Value (Data) Types Type Example Description String Howdy A series of characters inside quote marks Number 4.5 Any number not inside quote marks Boolean true A logical true or false Null null Completely devoid of any value Object A software thing that is defined by its properties and methods (arrays are also objects) Function A function definition A language that contains these few data types simplifies programming tasks, especially those involving what other languages consider to be incompatible types of numbers (integers versus real or floating-point values). In some definitions of syntax and parts of objects later in this book, I make specific reference to the type of value accepted in placeholders. When a string is required, any text inside a set of quotes suffices. You will encounter situations, however, in which the value type may get in the way of a smooth script step. For example, if a user enters a number into a form s text input field, the browser stores that number as a string value type. If the script is to perform some arithmetic on that number, you must convert the string to a number before you can apply the value to any math operations. You see examples of this later in this lesson. Variables Cooking up a dish according to a recipe in the kitchen has one advantage over cooking up some data in a program. In the kitchen, you follow recipe steps and work with real things: carrots, milk, or a salmon fillet. A computer, on the other hand, follows a list of instructions to work with data. Even if the data represents something that looks real, such as the text entered into a form s input field, once the value gets into the program, you can no longer reach out and touch it. In truth, the data that a program works with is merely a collection of bits (on and off states) in your computer s memory. More specifically, data in a JavaScript enhanced Web page occupies parts of the computer s memory set aside for exclu sive use by the browser software. In the olden days, programmers had to know the numeric address in memory (RAM) where a value was stored to retrieve a copy of it
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Anonymous web server - Programming Fundamentals, Part I The tutorial breaks away

Tuesday, July 24th, 2007

Programming Fundamentals, Part I The tutorial breaks away from HTML and documents for a while as you begin to learn programming fundamentals that apply to practically every scripting and programming language you will encounter. Here, you start learning about variables, expressions, data types, and operators things that might sound scary if you haven t programmed before. Don t worry. With a little practice, you will become quite comfortable with these terms and concepts. What Language Is This? The language you re studying is called JavaScript. But the language has some other names that you may have heard. JScript is Microsoft s name for the language. By leaving out the ava, the company doesn t have to license the Java name from its trademark owner: Sun Microsystems. A standards body called ECMA (pronounced ECK-ma) now governs the specifications for the language (no matter what you call it). The document that provides all of the details about the language is known as ECMA-262 (it s the 262nd stan dard published by ECMA). Both JavaScript and JScript are ECMA-262 compatible. Some earlier browser versions exhibit very slight deviations from ECMA-262 (which came later than the earliest browsers). The most serious discrepancies are noted in the core language reference in Part IV of this book. Working with Information With rare exception, every JavaScript statement you write does something with a hunk of information data. Data may be text information displayed on the screen by a JavaScript statement or the on/off setting of a radio button in a form. Each single piece of information in programming is also called 6 CHAPTER …. In This Chapter What variables are and how to use them Why you must learn how to evaluate expressions How to convert data from one type to another How to use basic operators ….
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Space web hosting - CD-34 Part II . JavaScript Tutorial Listing 5-9:

Monday, July 23rd, 2007

CD-34 Part II . JavaScript Tutorial Listing 5-9: How Does This Page Work? Text Object Value Enter lowercase letters for conversion to uppercase:



If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

CD-33Chapter 5 .Scripts and HTML Documents (Photoshop web design) more than

Monday, July 23rd, 2007

CD-33Chapter 5 .Scripts and HTML Documents more than just objects. When I said earlier in this lesson that each statement of a JavaScript script does something, that something involves data of some kind. Data is the information associated with objects or other pieces of information that a script pushes around from place to place with each statement. Data takes many forms. In JavaScript, the common incarnations of data are num bers; text (called strings); objects (both from the object model and others you can create with scripts); and trueand false (called Boolean values). Each programming or scripting language determines numerous structures and limits for each kind of data. Fortunately for newcomers to JavaScript, the universe of knowledge necessary for working with data is smaller than in a language such as Java. At the same time, what you learn about data in JavaScript is immediately applicable to future learning you may undertake in any other programming lan guage don t believe for an instant that your efforts in learning scripting will be wasted. Because deep down scripting is programming, you need to have a basic knowl edge of fundamental programming concepts to consider yourself a good JavaScript scripter. In the next two lessons, I set aside most discussion about the document object model and focus on the programming principles that will serve you well in JavaScript and future programming endeavors. Exercises 1. Write the complete script tag set for a script whose lone statement is document.write( Hello, world. ) 2. Build an HTML document and include the answer to the previous question such that the page executes the script as it loads. Open the document in your browser. 3. Add a comment to the script in the previous answer that explains what the script does. 4. Create an HTML document that displays an alert dialog box immediately after the page loads and displays a different alert dialog box when the user clicks a form button. 5. Carefully study the document in Listing 5-9. Without entering and loading the document, predict a. What the page looks like b. How users interact with the page c. What the script does Then type the listing into a text editor as shown (observe all capitalization and punctuation). Do not type a carriage return after the = sign in the upperMe function statement; let the line word-wrap as it does in the following listing. It s okay to use a carriage return between attribute name/value pairs, as shown in the first tag. Save the document as an HTML file, and load the file into your browser to see how well you did.
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

CD-32 Part II . JavaScript Tutorial Figure 5-2: (Anonymous web server)

Monday, July 23rd, 2007

CD-32 Part II . JavaScript Tutorial Figure 5-2: The NN6 JavaScript Console window Scripting versus Programming You may get the impression that scripting is easier than programming. Scripting simply sounds easier or more friendly than programming. In many respects, this is true. One of my favorite analogies is the difference between a hobbyist who builds model airplanes from scratch and a hobbyist who builds model airplanes from com mercial kits. The from scratch hobbyist carefully cuts and shapes each piece of wood and metal according to very detailed plans before the model starts to take shape. The commercial kit builder starts with many prefabricated parts and assem bles them into the finished product. When both builders are finished, you may not be able to tell which airplane was built from scratch and which one came out of a box of components. In the end, both builders used many of the same techniques to complete the assembly, and each can take pride in the result. As you ve seen with the document object model, the browser gives scripters many prefabricated components with which to work. Without the browser, you d have to be a pretty good programmer to develop from scratch your own application that served up content and offered user interaction. In the end, both authors have working applications that look equally professional. Beyond the document object model, however, real programming nibbles its way into the scripting world. That s because scripts (and programs) work with
We recommend high quality webhost to host and run your jsp application: christian web host services.