Professional Documents
Culture Documents
functionfunc_name (paramx,paramy,etc..){} - defining function should have brackets even if it only has a line of code in it terms: o code block any group of codes enclosed in {} o function- is a code block with a name
string.toUpperCase();string.toLowerCase();
lastIndexOf( query ); starts searching from the last element in the string string.substring(x,y); extracts string from position x to y; y is optional and if unspecified, it extracts from x to string.length
y y y y
y y y
Methods of the window object y y y y y y y y y alert(stringX) alert dialog box blur() -used to remove focus from the current window. varintervalID = setInterval( 'writeit()', 2000); close() - will close the associated browser window confirm( string ) - lets you ask the user a simple OK or Cancel question window.focus() -used to give focus to the specified window. This is useful for bringing windows to the top of any others on the screen. moveBy([(-)left,right],[(-)up,down]) moveTo(x,y) moves the window to an absolute position on the screen open() opens a browser ; can have the following parameters o url -This is the Web address of a Web page that you want toautomatically load into the new window. o Name - This is a string that will be placed into the window.nameproperty of the new window.
Javascript Crash Course Notes featuresList - This is a string specifying the features the new windowshould have. This parameter lets you specify how big thewindow should be, if it should have toolbars, scroll bars,and so on. o Replace - This is a Boolean value that specifies if the Web addressspecified in the first parameter should replace the currententry in the history list. var response = prompt( question , defaultresponsevalue ); resizeTo(height,width) scroll() and scrollTo() scrollBy(x,y) -scroll a document a specified number of pixels fromits current position varintervalID =setInterval( string ,millisecondsbeforeiteration) and clearInterval(intervalID) setTimeout( string ,timeinmilliseconds) and clearTimeout() o
y y y y y y
document.alinkColor = gray; color of the current active link document.bgColor = red; vartheCookie = document.cookie; // read the cookie document.cookie = theCookie; // write the cookie