Showing posts with label javascript basic. Show all posts
Showing posts with label javascript basic. Show all posts

Friday, March 2, 2012

the do .....while loop task on java script chapter 8

this is the one of the variant of while loop , the principal of the loop is by do the command first and then lookfor the conditional onthe bottom of its inside of (.....) sign after "while"
or let me show you the example :
as simple the composition is like this
do
{

code tobe executed
}
while(var<=endvalue ) ''the conditional statement you decide as the parameter

if you stiil confuse lets see the real example

do
{
i++;
document.write( "the value are increasing from " + i);


}
while(i<=10)
can you tell me the result?

Thursday, March 1, 2012

Looping Control on java script chapter 7

<html>
<body>
<script type="text/javascript">
for(i=0;i<=6;i++)
{
document.write("the number is "  + i)
document.write("</br>")
}


</script>

</body>
</html>



the result shown

the number is 0
the number is 1
the number is 2
the number is 3
the number is 4
the number is 5
the number is 6


as you see above there is a looping to call the variable "i"
it has increasing value that generate by condition "for"
you can try that.................
javascript easy right?......

Monday, February 27, 2012

Geting Date Variable chapter 6

you may need this Date Variable with its function to mention what day this is.......... here are the function

<html>


<body>
<script type="text/javascript">
var d=new Date( );
document.write (d);






</script>


</body>


</html>



the result will be
Sat Feb 12 25 2012 23:01:09 GMT-0700 (GMT Standard Time)

surely its easy right   try that

Sunday, February 26, 2012

Creating random value on javascript

with this function you can try a random value function of a variable
command use : Math.random ( );

here are the example :

<html>
<body>

<script type="text/javascript">
var d = Math.random();
if(r<50)
{
document.write("you will see the value of random r is "  + r);
}
else
{
document.write("you will see second chance the value of r is "  + r)
}
</script>

</body>
</html>

on the above you can see that random value is created by function Math.random

the result may vary from that codes you can try it
its usually use to validating the form login or some other that need to validate the data by fiting the number defined by the funtion and the input text from the user , how it can? learn on next our post may be you want........

Saturday, February 25, 2012

The use of java script (almost forget to tell you)

java script commonly use on website building , to make its better looks and many more today
- give HTML desingner a programing tool it surely do with a very simple syntax
- give dynamic view for the content of their site
   ex :  document.write("<h2>" + name + "</h2>" which the word name is a variable that dinamycally follow
   the Instruction
- can do some even after finish loading page or on load a page
- validating the data commonly is the main purpose, many site take the java script
- create cookies to store and retrieve the visitors on cumputers
many more you can discover on this java script so keep learn and stay sharp........

Friday, February 24, 2012

Java Script Operator chapter 4

 One the most important on all programing languanges is "Operator"
Operator is the common fuction that use to operate the logic programing
here are some of them


Operator
Description
-
Subtraction (minus)
+
Addition
*
Multiplication
/
Division(div)
%
Modulus(div reminder)
++
Increment
--
Decrement


here are the example of using Operators

var x;
var y;

x=2;
y=0;

y=x+y
document.write(y);


the result will shown

2

the other example

var x = 2;

x++;
document.write(x);

the result shown

3

try using another operator it would be fun to discover it.......
you can try this on post the result

x=5;
y=2
z=0

z=x/y;
y=x/z
x=y/z
the result is?

Wednesday, February 22, 2012

using Variable chapter 3

creating variable is depend on how many things that we want to give a value  here are the ex ample

......................................
var x ;
x=1;
...................
thats mean that you've give the value of x variable , it is 1
anothe example :

var rt;
rt ="vanya"

this mean that rt is given value "vanya"

Tuesday, February 21, 2012

Declaring(creating) Variable chapter 2

on java to creating vaiables use the command "var" thats mean that you creating a variable exactly
example :
................................
var budi
var tono 
var x 
 ..........................
creating a variable its mean that you give a value to the object  that you've been made

Sunday, February 12, 2012

Put Java Script on HTML page chapter 1

here are the example to put java script on HTML page

<html>
<body>
<script type="text/javascript">

document.write("Hello World");
</script>
</body>
</html>

the result will shown


Hello World

 from the example above you can make some trial to the code
you can try few words for your training
  • andreas
  • inisesta
  • learning

Task of Study Information Technology Headline Animator

Subscribe this blog