[php]<script type="text/javascript" src="script.js"></script>[/php]
the line above is one of some ways to include javascript to your web page. it will make sure you have separated script file to include, rather than writing scripts directly to the same html page with the content.
second way to include javascript is by writing or embed the script directly on our html page. for example in this page i wrote
[php]<script type="text/javascript">
alert("Admin Says Hi!!");
</script>[/php]
so that u will see box appear says “Admin Says Hi” with OK button.
further use of javascript provides u amazing ways to make your html page more beautiful. for example in news flash, picture gallery, slider, dll.
javascript in act:
1. statement
it consist of words or statement ended by semicolon;
2. variable
variable is the place when you store value.
var count;
statement above will declare variable named count.
count = “two”;
statement above will store data “two” in variable count.
u also can do it directly by typing
var count = “two”;
variable type includes integer, float, string, and array
3. conditions and loop
if (condition)
{
conditional code;
}
conditional operator
Example Operator A > B true if A is greater than B A >= B true if A is greater than or equal to B A < B true if A is less than B A
if else condition
if (condition)
{
conditional code;
}
else
{
alternative conditional code;
}
next post