Thursday, 7 December 2017

Javascript Dyanmic flexiblity

JavaScript extends the capabilities of the server. By providing a scripting language the software can do more without calling an external program.
This makes it easier for Webmasters to add features to their sites that browsers can take advantage of. And it can reduce the load on the server by keeping the processing within the server software.

LiveWire from Netscape is an integrated, visual environment for building client-server applications for Internet or enterprise networks. These applications can be for the public to access or limited to a specific audience such as an intranet.
LiveWire is actually a suite. It consists of the Netscape Navigator Gold, LiveWire Site Manager, LiveWire Server Extensions, LiveWire Server Front Panel, and JavaScript. LiveWire runs on the UNIX and Windows NT operating systems.

LiveWire automatically deletes any client object with no property values.So if you don't use a client object, you don't have to worry about deleting it. In other words, you only have to clean up after yourself.
The default expiration is ten minutes of inactivity. If the client does not send another request to the server within ten minutes of the previous request, the object expires.

The agent- property tells the server about the client's software, usually a browser. This information is a line of text, but there is no standard format to this text.
The same browser always presents the same information. For example, if you use Netscape Navigator 2.0 and your friend uses Netscape Navigator 2.0, the same information is sent by either of you when you access this server.

Each time a browser wants more information it sends a request to a server. Data about these requests are available on the server from the request object in JavaScript.
And if you have written CGI scripts, you should be familiar with the properties that are built into the request object.

Each time a new client accesses the server application, a new client object is created. However, there are no built-in properties for the client object.
If you need information retained about the client, then you create a property.

The ip property provides the IP address of the client. This tells the server from where on the Internet the request is sent and where to return a response. IP addresses are composed of a set of four numbers. Each is a value between 0 and 255. A sample IP number is 127.0.0.1.Usually the IP address you use when connecting with a host is unique, and no one else on the Net can use that address until you complete your session.
However, there are special cases of caches, proxies, and firewalls that require further study if you plan to use this property.IP addresses can often be used to tell which domain is connecting to the server. By using what is called reverse lookup, the server can often determine the domain name of the client computer. You might use this to determine how many hits are coming from America Online or any other site.

A very common use for a client property is a client identification number. When the client first accesses the server, he can receive a form. The server can then process this information and assign the client an identification number.
This might be randomly generated or looked up from a list of previous customers.As an example, a client can send a request. Part of the request can include a user supplied customer number in the text box named idnumber. You can then create a client property called custNo with the following line: client.custNo = request.idnumber

A request may include additional information. Your browser's request may have resulted from submitting information from an HTML form. This information becomes a request property.
It does not matter if the data is submitted with either the post or get method. The name of each element of the form becomes a property name.For example, take a form with a text element with the name of answer. Complete the text box with a value of "59" and submit it to the server.The server receives the information in the form of "answer=59." The request object now has a property called request.answer which reflects the value of "59."


JavaScript offers tremendous flexibility in interacting with the user. You can create entire documents on-the-fly. You can dynamically customize both the content of a document and its appearance according to user criteria and other factors.
User input also benefits from this flexibility: prompts can be dynamically generated, and even free-form input can be processed.

You can specify either a variable or a function name on the right side of the colon in a javascript: URL. Normally, you use a variable to return an unchanging value, whereas you use a function to return dynamic content.

If a variable name refers to an object, however, and that object has a toString() method defined, the function associated with the toString() method is called when the object is referenced in a javascript: URL, in which case dynamic content may be returned.
For many applications in which a degree of apparent randomness is desirable, using the Date object alone yields acceptable results. When you need a series of "random" numbers one after another,however, the Date object isn't of much help.

You can also store information in request properties. One property you might want to consider adding is a time and date stamp.
But you must remember that the life of a request object is rather short, so values stored in these properties are not stored for long.

Chances are, whatever calculations you're performing or effects you're creating will be finished before the Date object advances to a new value.
Through a database lookup or search function, the user can enter a set of keywords. In that case, you need to parse the input field; that is, break it into a list of individual words or terms.

The process of parsing is fairly straightforward. The first step is to define the whitespace characters that can separate the terms in your input field. Whitespace is usually defined as blank, or space, characters, and tabs. It may also include carriage returns and linefeeds, as well as certain other nondisplaying characters.

The parseKeywords() function examines each character in the input string to decide if it is a whitespace or delimiter character. If it is not, the character is added to the current word.
And, if so, the current word, if any, is added to the list, and preparation is made for a new word. You also add the current word to the list when you reach the last character of the input string.

The Index object's add() method, AddToIndex(), accepts an object to be indexed and a list of keywords in the form of a KeywordList object. For each keyword in the KeywordList, AddToIndex() first checks to see whether an IndexItemList object is associated with the keyword. Note that it uses the keyword value itself as an index into the array.
If no IndexItemList object exists for the keyword, a new object is created and added to the array, again using the keyword as the index. Finally, the object to be indexed is added to the IndexItemList for that keyword value.