splintercell!
13-07-2005, 05:38 PM
Javascript is quite an old language now and is usually replaced by its more advanced and modern partners php, asp etc. but its still very useful in places and a good language to learn. It is useful for people with non php supported hosts such as freewebs because they can perform variable functions using javascript.
So lets start off as all tutorials should! Lets say HELLO WORLD! To write a basic statement in Javascript you need to use the following code:
<script type="text/javascript">
document.write("Hello World!")
</script>
this will the produce the statement in your browser Hello World! but this is the most simple state of javascript.
Next we move onto variables. This is very much the same as php. See below:
<script type="text/javascript">
var phrase = "Hello World!"
document.write(phrase)
document.write("<h1>"+phrase+"</h1>")
</script>
so here the script take the statement Hello World and in the document.write tag it more or less calls for it.
Last I am going to show you the If statement. It goes something like this:
<script type="text/javascript">
var d = new Date()
var time = d.getHours()
if (time < 10)
{
document.write("<b>Good morning</b>")
}
</script>
This simply checks the time and if it is before 10am then it displays the message Good morning. This can be very useful in welcoming messages on your site.
Hopefully this will have given you a little insight into the world of javascript.
[Edited By partie2] (Forum Moderator) Thread Stuck, Great Job :)
So lets start off as all tutorials should! Lets say HELLO WORLD! To write a basic statement in Javascript you need to use the following code:
<script type="text/javascript">
document.write("Hello World!")
</script>
this will the produce the statement in your browser Hello World! but this is the most simple state of javascript.
Next we move onto variables. This is very much the same as php. See below:
<script type="text/javascript">
var phrase = "Hello World!"
document.write(phrase)
document.write("<h1>"+phrase+"</h1>")
</script>
so here the script take the statement Hello World and in the document.write tag it more or less calls for it.
Last I am going to show you the If statement. It goes something like this:
<script type="text/javascript">
var d = new Date()
var time = d.getHours()
if (time < 10)
{
document.write("<b>Good morning</b>")
}
</script>
This simply checks the time and if it is before 10am then it displays the message Good morning. This can be very useful in welcoming messages on your site.
Hopefully this will have given you a little insight into the world of javascript.
[Edited By partie2] (Forum Moderator) Thread Stuck, Great Job :)