Join the Internet MosaicListings are Free!
How it Works | Blog | FAQ | Tell A Friend | Contact | Login
Username



javascripts
Category



Internet Computers Programming
Country



Pakistan
aamer rehman
Joined: 2008-10-16
Visit Website
View Guestbook
yahoo:aamerrehman10@yahoo.com
java   java examples   source codes   javascripts examples  learn javascripts   javascripts   learn java   learn java scripts.   

Bookmark This Page



  Mosaic Links

  Web Links

Learn Javascripts
Welcome to Javascripts. Here you can learn Javascripts with examples.
Learn javacripts Comments
The string Object

The string object provides properties and methods for working with string literals and variables.

Properties

length An integer value containing the length of the string expressed as the number of characters in the string.


Methods

anchor(name) Returns a string containing the value of the string object surrounded by an A container tag with the NAME attribute set to name.


big() Returns a string containing the value of the string object surrounded by a BIG container tag.


blink() Returns a string containing the value of the string object surrounded by a BLINK container tag.


bold() Returns a string containing the value of the string object surrounded by a B container tag.


charAt(index) Returns the character at the location specified by index.


fixed() Returns a string containing the value of the string object surrounded by a FIXED container tag.


fontColor(color) Returns a string containing the value of the string object surrounded by a FONT container tag with the COLOR attribute set to color where color is a color name or an RGB triplet.


fontSize(size) Returns a string containing the value of the string object surrounded by a FONTSIZE container tag with the size set to size.


indexOf(findString,startingIndex) Returns the index of the first occurrence of findString, starting the search at startingIndex where startingIndex is optional—if it is not provided, the search starts at the start of the string.


italics() Returns a string containing the value of the string object surrounded by an I container tag.


lastIndexOf(findString,startingIndex) Returns the index of the last occurrence of findString. This is done by searching backwards from startingIndex. startingIndex is optional and assumed to be the last character in the string if no value is provided.


link(href) Returns a string containing the value of the string object surrounded by an A container tag with the HREF attribute set to href.


small() Returns a string containing the value of the string object surrounded by a SMALL container tag.


strike() Returns a string containing the value of the string object surrounded by a STRIKE container tag.


sub() Returns a string containing the value of the string object surrounded by a SUB container tag.


substring(firstIndex,lastIndex) Returns a string equivalent to the substring starting at firstIndex and ending at the character before lastIndex. If firstIndex is greater than lastIndex, the string starts at lastIndex and ends at the character before firstIndex.


sup() Returns a string containing the value of the string object surrounded by a SUP container tag.


toLowerCase() Returns a string containing the value of the string object with all character converted to lower case.


toUpperCase() Returns a string containing the value of the string object with all character converted to upper case.


The submit Object

The submit object reflects a submit button from an HTML form in JavaScript.

Properties

name A string value containing the name of the submit button element.


value A string value containing the value of the submit button element.


Methods

click() Emulates the action of clicking on the submit button.


Event Handlers

onClick Specifies JavaScript code to execute when the submit button is clicked.


The text Object

The text object reflects a text field from an HTML form in JavaScript.

Properties

defaultValue A string value containing the default value of the text element (i.e. the value of the VALUE attribute).


name A string value containing the name of the text element.


value A string value containing the value of the text element.


Methods

focus() Emulates the action of focusing in the text field.


blur() Emulates the action of removing focus from the text field.


select() Emulates the action of selecting the text in the text field.


Event Handlers

onBlur Specifies JavaScript code to execute when focus is removed from the field.


onChange Specifies JavaScript code to execute when the content of the field is changed.


onFocus Specifies JavaScript code to execute when focus is given to the field.


onSelect Specifies JavaScript code to execute when the user selects some or all of the text in the field.


The textarea Object

The textarea object reflects a multi-line text field from an HTML form in JavaScript.

Properties

defaultValue A string value containing the default value of the textarea element (i.e. the value of the VALUE attribute).


name A string value containing the name of the textarea element.


value A string value containing the value of the textarea element.


Methods

focus() Emulates the action of focusing in the textarea field.


blur() Emulates the action of removing focus from the textarea field.


select() Emulates the action of selecting the text in the textarea field.

Michael Yu's Civic Car Viewer
Michael Yu's Civic Car Viewer
Michael Yu's Civic Car viewing program provides you with a good example of how to combine frames with JavaScript. It's located at

http://www-leland.stanford.edu/~guanyuan/public/car/car.html


The premise behind the program is simple: In one frame, a view of a Honda Civic is displayed. In the other frame, the user has four directional controls to rotate the view in steps in any direction: up, down, left, or right.

In achieving this, Yu has made use of a simple file naming scheme, the windows.location property, and the frames array.

The program in Listing W3.1 produces results similar to those in Figures W3.1 and W3.2.

Input

Listing W3.1 Source code for Michael's Civic Car Viewer page.

Parent frameset:

<HTML>

<head>

<title> Car View 3D</title>

</head>

<FRAMESET ROWS="18%, 72%, 10%">

<FRAME SRC="head.html" NAME="head" TARGET="head" SCROLLING="no">

<FRAMESET COLS="68%, 32%">

<FRAME NAME="left" SRC="left.html" NORESIZE>

<FRAME NAME="right" SRC="right.html" NORESIZE>

</FRAMESET>

...


JAVA SCRIPT SPREADSHEET

Creating a Spreadsheet in JavaScript

In this chapter, you are going to apply what you have learned to developing another application—general purpose spreadsheet.

While you have experience creating, and have seen examples of specific-function calculators, JavaScript's ability to work with forms and its math functions are not limited to these types of applications.

Using forms and cookies, it is possible to create a general-purpose spreadsheet that retains its formulas between sessions.

The Specifications

The spreadsheet has several basic requirements:



Copyright © 2012 Island Media