Not that hard a language.
Try:
http://www.w3schools.com/JS/default.asp
http://www.4guysfromrolla.com/webtech/111599-1.shtml
http://www.webteacher.com/javascript/index.html
It looks like C# (and therefore by extension C / C++?)
Loops:
for (i = 0; i < x; i ++)
{
// code loop here
}
‘while’ and ‘do’ loops are similar.
‘if’ statements:
if (i == x)
{
// code for i is equal to x
}
else
{
// code for i is not equal to x
}
Note the ‘==’, otherwise (with a single ‘=’) you are assigning a value to i
So, if you have a form element (probably in this case a text box) named ‘txtFirstName’ your code to make sure it contains a value would be something like:
if (document.getElementByID(‘txtFirstName’).text == ”)
(
alert(‘First name is required’); // note double slash for the comment
return false; // ‘return false’ to exit code
}
‘alert’ puts up the (annoying) message! Yes, I know this doesn’t validate ‘ ‘ entries (ie, those with spaces entered) but they’re not hard to code around…
Hope this helps – email me at vdub1992[at]hotmail[dot]com if you want some examples. I’m sure I can dig some out.
My programming ‘lightbulb’ moment was when I realised that all languages do the same thing, they just say it differently! (With, I guess, some exceptions: ADA maybe?).
Shoot me down if you want, STW massif, I’m just trying to recall some stuff!