Friday, 21 October 2011

Introduction To Javascript

In todays lecture with David we started Javascript.

"Javascript is an easy-to-use programming language that can be embedded in the header of your web pages. It can enhance the dynamics and interactive features of your page by allowing you to perform calculations, check forms, write interactive games, add special effects, customize graphics selections, create security passwords and more."

http://www.webteacher.com/javascript/

http://www.w3schools.com/js/default.asp

We learnt some simple codes to start with such as how to say hello:

< html >
< body >
< script language="javascript" >
document.write('Hello');
< /script >
< /body>
< /html >

& how to repeat a word however amount of times, here shows x 6 times. Could change it to any number:

< html >
< body >
< script language="javascript" >
row=0;
while (row<6) { document.write("X "); row=row+1; } < /script >
< /body >
< /html >

We then had the task to ask the user to guess a number and tells the
user if it is high, low or bulls eye. We had to read through online tutorials to find this. I found it quite difficult, although reading through it online meant I could try other codes such as pop up box & loops.

The simple codes such as "hello" and repeating it in sequence was quite easy to grasp however I stuggled with the harder stuff so going to read it on w3schools this week & try to get my head around it all.

No comments:

Post a Comment