Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
I have a simple page here with a contact form. If I click the Submit button to send this, it's actually popping up this message, "Please provide at least an email address!" and it's stopping me from submitting the form. Let me show you how that's done. The form itself, my HTML, is nothing particularly special. It's a standard form. It's actually submitting just to a local page, but normally you would of course be submitting to a server. I am just going to come down towards the bottom where I have a place, just a span tag with an id of errorMessage, there is nothing in it right now.
That code says, if the email field is empty, so document.getElementById email.value equal to an empty string, we're going to set the innerHTML of that error message to, "Please provide an email address," and the most important thing here to stop the form from submitting would be return false. In fact, this is really all that I would need, although for best practice what I'm doing is saying no, if that wasn't empty, if there was something in the email field, we're going to reset that message if it did have anything in it and explicitly return true, saying yes, go ahead.
So back over, into Firefox, when we click this without providing an email address, it doesn't submit anything. If I come up here and say email@example.com-- and yes, right now we could really put anything in here--then it immediately allows me to submit, which is just redirecting to a local page right now, but the concept is exactly the same, even if you were submitting to a server-side component. Make no mistake, the single most important piece of this whole code was this one, that when the onsubmit calls an eventHandler, we need to either return false to stop that submit event from going on any further, or return true and say, yes, I've run the script, just go ahead and do whatever you were going to do anyway.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.