420 likes | 443 Views
Learn how to create and use functions in Microsoft Visual Studio .NET 2003. Follow step-by-step instructions to design HTML pages and implement functions using JavaScript. Enhance your coding skills and understanding of event-driven programming.
E N D
Using Microsoft Visual Studio .NET Development Environment and Introducing Functions
Go to Start/Programs/Microsoft Visual Studio .NET 2003/Microsoft Visual Studio .NET 2003
Return to Design, place cursor over Toolbox, click on tack icon to lock in place.
Use the Insert Table Dialog box to select the number of rows, columns, etc.
Insert a Flow layout panel (div) in column 1 and another table (6 rows, a column) in column 2
Place the cursor in the top row of the right column and the click on the Button button of the Toolbox
Highlight the div and click on the ellipsis next to the style
Click on the Background button, click on the dropdown listbox next to Color
Function • A function is a set of statements that we separate from the rest of the code and give a name. • To execute the code we must “call” the function. • It is possible to return a result (as the prompt function does). • One reason for doing this is if the same set of code might be used in a number of different colors.
Events and Functions • Another reason for a function is to have code that is executed when an event (such as the user clicking a button) is raised.
outerHTML versus document.write() • Previously we used document.write() to add new HTML code to a page. • If there is some pre-existing HTML code on the page we can change it by using the outerHTML property. • There is a similar construct known as innerHTML. • The pre-existing HTML tag must have an id attribute so that we can refer to it.
Click on the Style ellipsis, click on Position, set the Width property
References • Beginning JavaScript, Paul Wilton • Functions: p. 92 • Buttons: p. 195 • outerHTML: p. 462 • http://www.webopedia.com