100 likes | 109 Views
JavaScript 102. Nancy Leiby December 11, 2001. JavaScript Notes. Debugging JavaScript in Netscape … put ‘javascript:’ in the URL text box to bring up the Console Netscape is pickier about JavaScript Case sensitive Two ways to specify the form: document. formname . fieldname …
E N D
JavaScript 102 Nancy Leiby December 11, 2001 JavaScript 102
JavaScript Notes • Debugging JavaScript in Netscape … put ‘javascript:’ in the URL text box to bring up the Console • Netscape is pickier about JavaScript • Case sensitive • Two ways to specify the form: • document.formname.fieldname… • document.forms[0].fieldname… JavaScript 102
1onLoad.cfm • Perform an action when the page is loaded using onLoad • <BODY onLoad=“…”> • Set the focus of the cursor to a text box or other field in a form using the JavaScript focus() function JavaScript 102
2onSubmit.cfm • Perform an action when the form is submitted using onSubmit • Use when validating data: option to not submit the form when bad data found • <FORM … onSubmit=“return …”> • If true is returned, the form is submitted • If false is returned, the form is not submitted JavaScript 102
3onClick.cfm, 3location.cfm • Perform an action when an object is selected using onClick • Use with button, checkbox, radio, link (image button) • Validation • Change the form action destination using JavaScript document.location= • <INPUT … onClick=“…”> JavaScript 102
4dynamicfieldnames.cfm • Access a field/object with a dynamically created name • Evaluate("form.fn"&i) • document.formname.elements[“fn"+i]… • Submit a form using the JavaScript submit() function JavaScript 102
5converttointeger.cfm • In JavaScript multiply by 1to convert a field value from a string (default) to a number • JavaScript append and numbers JavaScript 102
6relatedlists.cfm • Perform an action when a field is changed using onChange • <SELECT … onChange=“…”> • Convert multi-dimensional arrays in CF into JavaScript arrays using CFWDDX • <CFWDDX action="CFML2JS" … JavaScript 102
7callback.cfm, 7caller.cfm • Open a page to allow the user to make a selection and insert the selection on the calling page • Call a JavaScript function in the page that opened the current page using opener property. JavaScript 102
Information • Contact me at: • nancy.j.leiby@syntegra.com • My favorite JavaScript book: • JavaScript Bible by Danny Goodman(IDG Books Worldwide, Inc.) JavaScript 102