Archive for August, 2007

Business web hosting - CD-101Chapter 11 .Scripting Frames and Multiple Windows It

Monday, August 27th, 2007

CD-101Chapter 11 .Scripting Frames and Multiple Windows It is often difficult at first to visualize the frameset as a window object in the hier archy. After all, with the exception of the URL showing in the Location/Address field, you don t see anything about the frameset in the browser. But that window object exists in the object model. Notice, too, that in the diagram the framesetting parent window has no document object showing. This may also seem odd because the window obviously requires an HTML file containing the specifications for the frameset. In truth, the parent window has a document object associated with it, but it is omitted from the diagram to better portray the relationships among parent and child windows. A frameset parent s document cannot contain most of the typical HTML objects such as forms and controls, so references to the parent s document are rarely, if ever, used. If you add a script to the framesetting document that needs to access a property or method of that window object, references are like any single-frame situation. Think about the point of view of a script located in that window. Its immediate universe is the very same window. Things get more interesting when you start looking at the child frames. Each of these frames contains a document object whose content you see in the browser window. And the structure is such that each document is entirely independent of the other. It is as if each document lived in its own browser window. Indeed, that s why each child frame is also a window type of object. A frame has the same kinds of properties and methods of the window object that occupies the entire browser. From the point of view of either child window in Figure 11-2, its immediate container is the parent window. When a parent window is at the very top of the hierarchical model loaded in the browser, that window is also referred to as the top object. References among Family Members Given the frame structure of Figure 11-2, it s time to look at how a script in any one of those windows can access objects, functions, or variables in the others. An important point to remember about this facility is that if a script has access to an object, function, or global variable in its own window, that same item can be reached by a script from another frame in the hierarchy (provided both documents come from the same Web server). A script reference may need to take one of three possible routes in the two- generation hierarchy described so far: parent to child; child to parent; or child to child. Each of the paths between these windows requires a different reference style. Parent-to-child references Probably the least common direction taken by references is when a script in the parent document needs to access some element of one of its frames. The parent contains two or more frames, which means the parent maintains an array of the child frame objects. You can address a frame by array syntax or by the name you assign to it with the NAMEattribute inside the tag. In the following exam ples of reference syntax, I substitute a placeholder named ObjFuncVarName for whatever object, function, or global variable you intend to access in the distant window or frame. Remember that each visible frame contains a document object,
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

CD-100 Part II . JavaScript Tutorial Figure 11-1: (Top web site)

Sunday, August 26th, 2007

CD-100 Part II . JavaScript Tutorial Figure 11-1: Single-frame window and document hierarchy Window Document The instant a framesetting document loads into a browser, the browser starts building a slightly different hierarchy model. The precise structure of that model depends entirely on the structure of the frameset defined in that framesetting document. Consider the following skeletal frameset definition: This HTML splits the browser window into two frames side by side, with a different document loaded into each frame. The model is concerned only with structure it doesn t care about the relative sizes of the frames or whether they re set up in columns or rows. Framesets establish relationships among the frames in the collection. Borrowing terminology from the object-oriented programming world, the framesetting document loads into a parent window. Each of the frames defined in that parent window document is a child frame. Figure 11-2 shows the hierarchical model of a two-frame environment. This illustration reveals a lot of subtleties about the relationships among framesets and their frames. Top, Parent Document Child Frame Document Child Frame Figure 11-2: Two-frame window and document hierarchy
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

Scripting Frames and Multiple Windows One of the

Sunday, August 26th, 2007

Scripting Frames and Multiple Windows One of the cool aspects of JavaScript on the client is that it allows user actions in one frame or window to influence what happens in other frames and windows. In this section of the tutorial, you extend your existing knowledge of object references to the realm of multiple frames and windows. Frames: Parents and Children You probably noticed that at the top of the simplified document object hierarchy diagram (refer to Figure 8-1) the window object has some other object references associated with it. In Chapter 8, you learned that self is synonymous with window when the reference applies to the same window that contains the script s document. In this lesson, you learn the roles of the other three object references frame, top, and parent. Loading an ordinary HTML document into the browser cre ates a model in the browser that starts out with one window object and the document it contains. (The document likely contains other elements, but I m not concerned with that stuff yet.) The top rungs of the hierarchy model are as simple as can be, as shown in Figure 11-1. This is where references begin with window or self (or with document because the current window is assumed). 11 CHAPTER …. In This Chapter Relationships among frames in the browser window How to access objects and values in other frames How to control navigation of multiple frames Communication skills between separate windows ….
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

CD-98 Part II . JavaScript Tutorial Enter any (Jetty web server)

Saturday, August 25th, 2007

CD-98 Part II . JavaScript Tutorial Enter any string:
4. Create a page that has two fields and one button. The button should trigger a function that generates two random numbers between 1 and 6, placing each number in one of the fields. (Think of using this page as a substitute for rolling a pair of dice in a board game.) 5. Create a page that displays the number of days between today and next Christmas. …
We recommend high quality webhost to host and run your jsp application: christian web host services.

Web hosting company - CD-97Chapter 10 .Strings, Math, and Dates global variable,

Saturday, August 25th, 2007

CD-97Chapter 10 .Strings, Math, and Dates global variable, copying its millisecond value to a new variable: todayInMS. To get a date seven days from now, the next statement adds the number of milliseconds in seven days (60 seconds times 60 minutes times 24 hours times seven days times 1000 milliseconds) to today s millisecond value. The script now needs a new date object calculated from the total milliseconds. This requires invoking the Date object constructor with the milliseconds as a parameter. The returned value is a date object, which is automatically converted to a string version for writing to the page. Letting JavaScript create the new date with the accumulated number of milliseconds is more accurate than trying to add 7 to the value returned by the date object s getDate()method. JavaScript automatically takes care of figuring out how many days there are in a month as well as in leap years. Many other quirks and complicated behavior await you if you script dates in your page. As later chapters demonstrate, however, the results may be worth the effort. Exercises 1. Create a Web page that has one form field for entry of the user s e-mail address and a Submit button. Include a pre-submission validation routine that verifies that the text field has the @ symbol found in all e-mail addresses before you allow submission of the form. 2. Given the string Netscape Navigator, fill in the blanks of the myString.substring() method parameters here that yield the results shown to the right of each method call: var myString = Netscape Navigator myString.substring(___,___) // result = Net myString.substring(___,___) // result = gator myString.substring(___,___) // result = cape Nav 3. Fill in the rest of the function in the listing that follows so that it looks through every character of the entry field and counts how many times the letter e appears in the field. (Hint: All that is missing is a forrepeat loop.) Wheel o Fortuna


From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

CD-96 Part II . (Web design online) JavaScript Tutorial Caution Be

Saturday, August 25th, 2007

CD-96 Part II . JavaScript Tutorial Caution Be careful about values whose ranges start with zero, especially the months. The getMonth() and setMonth() method values are zero based, so the numbers are one less than the month numbers you are accustomed to working with (for example, January is 0, December is 11). You may notice one difference about the methods that set values of a date object. Rather than returning some new value, these methods actually modify the value of the date object referenced in the call to the method. Date Calculations Performing calculations with dates requires working with the millisecond values of the date objects. This is the surest way to add, subtract, or compare date values. To demonstrate a few date object machinations, Listing 10-1 displays the current date and time as the page loads. Another script calculates the date and time seven days from the current date and time value. Listing 10-1: Date Object Calculations Date Calculation Today is:
Next week will be: In the Body portion, the first script runs as the page loads, setting a global variable (today) to the current date and time. The string equivalent is written to the page. In the second Body script, the document.write() method invokes the nextWeek() function to get a value to display. That function utilizes the today
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Web server type - CD-95Chapter 10 .Strings, Math, and Dates You can

Friday, August 24th, 2007

CD-95Chapter 10 .Strings, Math, and Dates You can also grab a snapshot of the Date object for a particular date and time in the past or future by specifying that information as parameters to the Dateobject constructor function: var someDate = new Date( Month dd, yyyy hh:mm:ss ) var someDate = new Date( Month dd, yyyy ) var someDate = new Date(yy,mm,dd,hh,mm,ss) var someDate = new Date(yy,mm,dd) var someDate = new Date(GMT milliseconds from 1/1/1970) If you attempt to view the contents of a raw date object, JavaScript converts the value to the local time zone string as indicated by your PC s control panel setting. To see this in action, use The Evaluator Jr. s top text box to enter the following: new Date() Your PC s clock supplies the current date and time as the clock calculates them (even though JavaScript still stores the date object s millisecond count in the GMT zone). You can, however, extract components of the date object via a series of methods that you apply to a date object instance. Table 10-1 shows an abbreviated listing of these properties and information about their values. Table 10-1 Some Date Object Methods Method Value Range Description dateObj.getTime() 0-… Milliseconds since 1/1/70 00:00:00 GMT dateObj.getYear() 70-… Specified year minus 1900; four-digit year for 2000+ dateObj.getFullYear() 1970-… Four-digit year (Y2K-compliant); version 4+ browsers dateObj.getMonth() 0-11 Month within the year (January = 0) dateObj.getDate() 1-31 Date within the month dateObj.getDay() 0-6 Day of week (Sunday = 0) dateObj.getHours() 0-23 Hour of the day in 24-hour time dateObj.getMinutes() 0-59 Minute of the specified hour dateObj.getSeconds() 0-59 Second within the specified minute dateObj.setTime(val) 0-… Milliseconds since 1/1/70 00:00:00 GMT dateObj.setYear(val) 70-… Specified year minus 1900; four-digit year for 2000+ dateObj.setMonth(val) 0-11 Month within the year (January = 0) dateObj.setDate(val) 1-31 Date within the month dateObj.setDay(val) 0-6 Day of week (Sunday = 0) dateObj.setHours(val) 0-23 Hour of the day in 24-hour time dateObj.setMinutes(val) 0-59 Minute of the specified hour dateObj.setSeconds(val) 0-59 Second within the specified minute
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

CD-94 Part II (Starting a web site) . JavaScript Tutorial floating-point number

Friday, August 24th, 2007

CD-94 Part II . JavaScript Tutorial floating-point number between 0 and 1. If you design a script to act like a card game, you need random integers between 1 and 52; for dice, the range is 1 to 6 per die. To generate a random integer between zero and any top value, use the following formula: Math.floor(Math.random() * (n + 1)) where n is the top number. (Math.floor() returns the integer part of any floating-point number.) To generate random numbers between one and any higher number, use this formula: Math.floor(Math.random() * n) + 1 where n equals the top number of the range. For the dice game, the formula for each die is newDieValue = Math.floor(Math.random() * 6) + 1 To see this, enter the right-hand part of the preceding statement in the top text box of The Evaluator Jr. and repeatedly press the Evaluate button. One bit of help JavaScript doesn t offer except in IE5.5 and NN6 is a way to spec ify a number-formatting scheme. Floating-point math can display more than a dozen numbers to the right of the decimal. Moreover, results can be influenced by each operating system s platform-specific floating-point errors, especially in earlier ver sions of scriptable browsers. For browsers prior to IE5.5 and NN6 you must perform any number formatting for dollars and cents, for example through your own scripts. Chapter 35 provides an example. The Date Object Working with dates beyond simple tasks can be difficult business in JavaScript. A lot of the difficulty comes with the fact that dates and times are calculated inter nally according to Greenwich Mean Time (GMT) provided the visitor s own inter nal PC clock and control panel are set accurately. As a result of this complexity, better left for Chapter 36, this section of the tutorial touches on only the basics of the JavaScript Date object. A scriptable browser contains one global Date object (in truth, one Date object per window) that is always present, ready to be called upon at any moment. The Date object is another one of those static objects. When you wish to work with a date, such as displaying today s date, you need to invoke the Date object construc tor to obtain an instance of a Date object tied to a specific time and date. For exam ple, when you invoke the constructor without any parameters, as in var today = new Date() the Date object takes a snapshot of the PC s internal clock and returns a date object for that instant. Notice the distinction between the static Dateobject and a date object instance, which contains an actual date value. The variable, today, con tains not a ticking clock, but a value that you can examine, tear apart, and reassem ble as needed for your script. Internally, the value of a date object instance is the time, in milliseconds, from zero o clock on January 1, 1970, in the Greenwich Mean Time zone the world standard reference point for all time conversions. That s how a date object contains both date and time information.
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

CD-93Chapter 10 .Strings, Math, and Dates knowledge of (Web hosting asp)

Thursday, August 23rd, 2007

CD-93Chapter 10 .Strings, Math, and Dates knowledge of expression evaluation to the test as you assemble expressions that utilize heavily nested constructions. For example, the following fragment needs to create a new string that consists of everything from the larger string except the first word. Assuming the first word of other strings can be of any length, the second statement utilizes the string.indexOf()method to look for the first space character and adds 1 to that value to serve as the starting index value for an outer string.substring() method. For the second parameter, the lengthproperty of the string provides a basis for the ending character s index value (one more than the actual character needed). var stringA = The United States of America var excerpt = stringA.substring(stringA.indexOf( ) + 1, stringA.length) // result: excerpt = United States of America Creating statements like this one is not something you are likely to enjoy over and over again, so in Chapter 34 I show you how to create your own library of string functions you can reuse in all of your scripts that need their string-handling facilities. More powerful string matching facilities are built into NN4+ and IE4+ by way of regular expressions (see Chapters 34 and 38). The Math Object JavaScript provides ample facilities for math far more than most scripters who don t have a background in computer science and math will use in a lifetime. But every genuine programming language needs these powers to accommodate clever programmers who can make windows fly in circles on the screen. The Math object contains all of these powers. This object is unlike most of the other objects in JavaScript in that you don t generate copies of the object to use. Instead your scripts summon a single Mathobject s properties and methods. (One Math object actually occurs per window or frame, but this has no impact whatso ever on your scripts.) Programmers call this kind of fixed object a static object. That Math object (with an uppercase M) is part of the reference to the property or method. Properties of the Math object are constant values, such as pi and the square root of two: var piValue = Math.PI var rootOfTwo = Math.SQRT2 Math object methods cover a wide range of trigonometric functions and other math functions that work on numeric values already defined in your script. For example, you can find which of two numbers is the larger: var larger = Math.max(value1, value2) Or you can raise one number to a power of ten: var result = Math.pow(value1, 10) More common, perhaps, is the method that rounds a value to the nearest integer value: var result = Math.round(value1) Another common request of the Mathobject is a random number. Although the feature was broken on Windows and Macintosh versions of Navigator 2, it works in all other versions and brands since. The Math.random()method returns a
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

CD-92 Part II . JavaScript Tutorial be buried (Personal web server)

Thursday, August 23rd, 2007

CD-92 Part II . JavaScript Tutorial be buried somewhere inside a long string, and all the script needs to know is whether the short string is present in the longer one wherever it might be. The string.indexOf() method returns a number indicating the index value (zero based) of the character in the larger string where the smaller string begins. The key point about this method is that if no match occurs, the returned value is -1. To find out whether the smaller string is inside, all you need to test is whether the returned value is something other than -1. Two strings are involved with this method: the shorter one and the longer one. The longer string is the one that appears in the reference to the left of the method name; the shorter string is inserted as a parameter to the indexOf() method. To demonstrate the method in action, the following fragment looks to see if the user is running Windows: var isWindows = false if (navigator.userAgent.indexOf( Win ) != -1) { isWindows = true } The operator in the ifconstruction s condition (!=) is the inequality operator. You can read it as meaning is not equal to. Extracting copies of characters and substrings To extract a single character at a known position within a string, use the charAt() method. The parameter of the method is an index number (zero based) of the character to extract. When I say extract, I don t mean delete, but rather grab a snapshot of the character. The original string is not modified in any way. For example, consider a script in a main window that is capable of inspecting a variable, stringA, in another window that displays map images of different corporate buildings. When the window has a map of Building C in it, the stringA variable contains Building C. The building letter is always at the tenth character position of the string (or number 9 in a zero-based counting world), so the script can examine that one character to identify the map currently in that other window: var stringA = Building C var bldgLetter = stringA.charAt(9) // result: bldgLetter = C Another method string.substring() enables you to extract a contiguous sequence of characters, provided you know the starting and ending positions of the substring of which you want to grab a copy. Importantly, the character at the ending position value is not part of the extraction: All applicable characters, up to but not including that character, are part of the extraction. The string from which the extraction is made appears to the left of the method name in the reference. Two parameters specify the starting and ending index values (zero based) for the start and end positions: var stringA = banana daiquiri var excerpt = stringA.substring(2,6) // result: excerpt = nana String manipulation in JavaScript is fairly cumbersome compared to some other scripting languages. Higher-level notions of words, sentences, or paragraphs are completely absent. Therefore, sometimes it takes a bit of scripting with string methods to accomplish what seems like a simple goal. And yet you can put your
Check Tomcat Web Hosting services for best quality webspace to host your web application.