![]() We can instruct JavaScript to watch for these events, and if or when they occur, execute the specified function.įor example, let's say we want to execute the showAlert() function after the body of the web page is fully loaded. When the page loads, or when a user clicks on, hovers over, or tabs to a specific link, these are all events. JavaScript functions are called in response to events. This function will display text in a dialog box that pops up on the screen.īefore this function can work, we must first call the showAlert() function. One useful function that's native to JavaScript is the alert() function. Most programming or scripting languages are similar to one another, including PHP and JavaScript, but there are subtle differences in their syntax (the rules of how the code must be written). Notice that it looks a lot like the PHP showTop() and showBottom() functions that were explained in the Beyond HTML document that you studied in the previous lesson. Start by opening your portfolio file javascript.html using your preferred text editor.Īdd the following JavaScript code to the section of your web page: You will start by writing a simple script, then gradually build upon that script, adding more functionality to it in subsequent lessons.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |