. (full stop, period, whatever you want to call it) and then the method name. So if we had a car object called 'car' which we knew had a 'start' method, we would do something like the following:
Note that we put some empty brackets after the method name, this is because the method doesn't take any parameters. Again I'm throwing around another term which I haven't taught yet - a parameter is simply a value that we have to pass to the method to make it do it's job. So if we had a method to change the car's gears, we might pass it a parameter that specifies what gear to change to - but in this case, we don't need to pass any parameters to start the car as the method knows what to do without any input.
alert) is like a method (it's just a named piece of code) however it stands alone (is not performed on an object). So instead of calling a function like
object.FunctionName(Any_Parameters_We_Want_To_Pass);, we would instead use something more like
FunctionName(Any_Parameters_We_Want_To_Pass);. But enough of that educational tangent - we'll learn more about functions and methods (and eventually how to create them) in later tutorials!
The point of all that is that there is a built in method called
write that can be performed on the pre-defined
document object which writes HTML to the current document. The 'document' object actually has a whole load of pre-set methods and the 'document' object basically provides access to all the HTML elements on a page.
Now if you open your index.html file in a web browser, you should notice that nothing happens. So why is this?
href attribute of an