• We Code
  • We Design
  • We Develope
  • We Write
  • We Share

menu

Monday, January 28, 2013

How To Use JavaScript With HTML 5

0 comments

HTML 5 is definitely the future of the web. So one must learn how to work on the JavaScript with Html 5.This article gives you the just introduction how to use JavaScript in html 5.
JavaScript moved a lot since Netscape livescript  . So the Html . As you all now traditional JavaScript have the DOM selector getElementById , getElementsByTagname,getElementsByClassname. The HTML 5 provide  javascript a new function called queryselector .So what does this query Selector does ? Before going into this lets see the syntax  of this function.
document.querrySelector(‘idname’);
Let’s see how its work?
If we have a HTML file like this.
<div>
<p id=’Australia’>Melbourne</p>
<p id=’US’>New York</p>
<p id=’Australia’>Sydney</p>
</div>
And now if you use function like document.querySelector(‘australia’).style.color =’red’; in your JavaScript file it will change the color of only first element with the id Australia to red. It means the Melbourne will turn into red and Sydney will not any effect on it.
There  is one more function  called document.querySelectorAll . If you will use this function like document.querySelectorAll(‘Australia’).style.color =’red’; it will turn all the elements associated with the Australia. It means it will turn Melbourne as we Sydney into red.
Read more ►

Thursday, January 24, 2013

how to move a div using javascript

4 comments
This tutorial is for how to move a DIV using java script . Here is the example  for moving a div by the help of javascript .
 
You have to make the div position Absolute for older browser . I made the ufo div position absolute for getting the div move using javascript  .


<html>
<head>
<style>
#ufo
{
position:absolute;}
</style>
<script>
function initial()
{
document.getElementById('ufo').style.left=200+'px';
document.getElementById('ufo').style.top=200+'px';
}
function right(){
document.getElementById('ufo').style.left=parseInt(document.getElementById('ufo').style.left)-5+'px';
}
function left(){
document.getElementById('ufo').style.left=parseInt(document.getElementById('ufo').style.left)+5+'px';
}
function top(){
document.getElementById('ufo').style.top=parseInt(document.getElementById('ufo').style.top)+5+'px';
}
function down(){
document.getElementById('ufo').style.top=parseInt(document.getElementById('ufo').style.top)-5+'px';
}
</script>
<link rel="stylesheet" href="main.css">
</head>
<body onload="initial()">
<div id = "ufo">
i am a moving dig. bring mouse over me fellas !!!! </div>
<button id="button" onClick="right();">Press here to move left</button>
<button id="button" onClick="left();">press here to move light</button>
<button id="button" onClick="top();">press here to move down</button>
<button id="button" onClick="down();">press here to move up</button>
</body>
</html>


If you wanna get animation using CSS3 in this . Here is the code for CSS3 make some animation .


#ufo
{
position:absolute;
display:block;
margin:auto;
text-align:center;
width:100px;
height:100px;
border:1px solid blue;
-webkit-transform:rotate(20deg);
background:-webkit-linear-gradient(top,yellow,green);
-webkit-border-radius:25px;
-webkit-box-shadow:rgba(110,110,110,.4) -10px 10px 10px;
text-shadow:rgba(110,110,110,.7) -1px 2px 3px;
}
#ufo:hover
{
width:200px;
height:200px;
-webkit-transform:rotate(70deg);
}
#button
{
height:30px;
weight:100px;
-webkit-transform:rotate(350deg);
margin:auto;
background:-webkit-linear-gradient(top,red,yellow);
-webkit-border-radius:25px;
-webkit-box-shadow:rgba(110,110,110,.4) -10px 10px 10px;

Any doubt any query related to  this comment bellow .
Read more ►

Friday, January 18, 2013

Introduction of JavaScript:

1 comments

Many people think java and JavaScript are little different .or the JavaScript is the subset of java. JavaScript is the very different from the java. The JavaScript is the world most misunderstood language. And at the same time you can say JavaScript is most popular computer language of the world. JavaScript is a object oriented language .Initially many thought and said about JavaScript it is not object oriented language it is object based language.  JavaScript have objects and it does not have classes like java. JavaScript is more object oriented than java . In JavaScript Objects are more dynamic .Objects are instance of a class in java .Class have more property and behavior in Java .In JavaScript objects are Dynamic collection property. If we have two property of the same name the new property will replace the new name which is more dynamic .The JavaScript have Object literal which creates new objects. As I said before JavaScript is a object oriented language .We will see all the JavaScript object oriented property in future .At the same time JavaScript is a functional language . So we will discuss all about JavaScript here in the JavaCourseBloghttp://javacourseblog.blogspot.in/.
Read more ►