Skip to main content

Posts

Showing posts from April, 2012

select function in java script

select  function in java script   this function is used to select the text of an  input  control < input type ="text" id ="txt1"> <input type  ="button" value ="select " onclick ="txt1.select()">

submit method in java script

submit  method in java script   this method is used to submit the web page  with out submit button <form id="fun1"> <sclect on change ="submit()"> <option >java</option> .  <option >.net</option> </select> </form>

form.element

form.element  by using this property we can get all the element of a form as an array <script> function fun1() { arr =frm1.elements for(i=0;i<arr.length;i++) { alert(arr[i}.type); } } </script> <form id= "frm1"> < input type ="text" id= "txt1"> < input type ="text" id= "txt1"> <input type ="button" valur="click" id ="but1"> < input type ="button" value ="get element" onclick = "fun1()"> </form>

event in java script

event  in java script   in  java script event is an object  refers the  current  action we can get the properties of current action using event object   every action contains some properties for examples mouse related event contain the property like x possession and y possession event type 

this in java script

this in java script  java script this is an object returns the properties of current control <script> function fun1() { alert{t.id); alert(t.value); } </script>  

conversation function java script

conversation function java script   by useing this function we can convert variable data type into another data type  parse int  this  function is converts a variables values in to the integer data types  it convert each and every character of a string in integer until the possible  conversions and    returns the converted values <script> x=10; y=20; alert(parsInt((x)+y)) </script> parse float :- a  it is same as pars int  to convert the input values as floating point  number  to check the Boolean values true  if it is  a  not a number  otherwise it return false , first it will convert the input string as number if it is converted successfully  then return false otherwise it return true  <script> a="1a00" alert (is nan(a)); </script>   

cookies in java script

cookies in java script  a cookie  is a text file  in client system  used to maintain sum information  stores in clients ram or hard disk based on the cookie type . cookie information we can access from any page with in the application cookie is main divided in two types  1. inmemory cookie  2. persistence  cookie  to create  a cookie    document.cookie  to use the create cookie   destroy cookie  by using negative value  we can destroy the cookies before the Expire time <script> document.cookie ="java=val; expries=-1"; </script>

protocols

 a protocols is  a set of instructions used to transfer the information from one location to another location this protocols is divided in two types stateful protocols state less protocols     stateful  protocol can maintain the state of the application means they can remember the previews  page values  page values . TCP/IP in window application we are using this protocols stateless protocols     this protocol can not maintain the state of the application .in web application we are using this protocol because the perform is vary fast  they can,t carry  the previous values examples     http (protocols)  

match function in java script

match function in java script  it compares two strings and returns the match matching is not available it return the null <script> str="well come to java script"; alert(str.match ("java script"); </script> replace  this function replace a string with new string < script> str="welcome to java script"; alert (str.replace ("java script ","java") </script> tolower case  converts the all    character   of the string in to lower case . alert (str.to lower case())  to upper case   converts the all lower to upper   character

string function in java script

string function in java script    a string is a collection of characters in java script  it is an object.we can declare the string in two ways <script> str= newstring("welcome to java script"); str1="welcome to karana"; alert(str); alert(str1); </script> length  rerun the total number of character on the string indexof()   return the index number of input charactor of a string <string> str=new string('well come to java script"); alert(str.indexof('e")); </script> char At this function return the character of input index number from a string <script> str=new string(well come to karana") alert (str.charat(1)); </script> charcode at  this function return the ASCII values input index numbers

operators in java script

operators in java script   arithmetic operators  increment/decrement operator   concatenation operator       comparison operator  assignment operator  negation operator  logical operator        

split in java script

split in java script  this function divides the string as array element based on the input delimiter <script> function fun1() { str="welcome to javascript"; arr= str.split(""); alert(arr[1]); } </script>  

join( ) in java script

join() in java script to join the element of an array with input string. it returns the output as a string <script> function fun1() { arr=new array(10,20,30) str =arr.join('/"); alert(str); } </script> <input type=" button" value="click"onclick="fun1()">

array length in java script

array length in java script by using this property we can get the total number of elements <script> function fun1() { arr=newarray(10,20,30) alert(arr.length[]); } </script> <input type="button" value="click"onclick=f"fun1()">  

array in javascript

array in javascript array is the collection of heterogeneous data types java script is a loosely type language that why we can store any type  value    in an array in java script  array is object it is providing number of methods &properties array we are creating useing new key word the syntax is array= new array(10,20,30) array is a combination of elements .each element contains the name and values .this key of 1st element starts from 0(zero)  last element end with n-1 <script> function fun1() { arr=newarray(10,new,php,java) alert(arr[]); } </script> <input type="button" value="value"  onclick ="fun1()"> </body>   

document.title

this property is usedto change the text of title bar . <script> function fun1() { document .title="mystyle" } </script> <body .onclick ="fun1()"> </body>  

document.body.scorllLeft

hold the left position of current document   <script>  function   fun1() { var toppos= document.body.scrolltop img1.style.top=toppos+100    //defallet"0" } </script>

document.body.appendchild

document.body.appendchild to append an element as child element in the current document <script> function fun1() { var con=document.create Element("input") con.type="button" con.value="enter name' con.style.color="green" con.onclick=fun2() document.body.appendchild(con) con1=document.createElement("div") con1.innerHTML="this is div" document .body.appendchild(con1) } function fun2() { alert("button is checked"); } </script> <input type="button" value="click" onclick="fun1()".

document .getElementById in java script

document .getElementById in java script ;- by using this element  we can get element from the current document base on the element id <script> function fun1() { var con =document .getElementById ("text") alert(con.value) var str =document .getElementById ("text2")value alert(str); } </script>  <input type="text" id ="text1" ></br> <input type="text" id ="text2"></br> <input type="button" value=click " onclick ="fun1()">

document .write in javascript

by using  this function  document object we can write some text on the web page <script> function fun1() { document.write('hello"); } </script> <input type ="button" value='click" onclick ="fun1()">

Functions

function is a set of executable statement function we are using for re usability .they are mainly divided into 2types  1. Free defined function 2. user defined function  Free Defined Function :-              They are built in  function available in the language example :-       alert, prompt   User Defined Functions :-      if any function is defined by the programmer at a time of project development comes under user defined functions <script  type ="text/java script" language="java script"> function fun1() {     var x=100;    var y=200;    var z=300;    alert (Z) } </script> <input type ="button" value="click"onclick ="fun1()">  we can also pass some values into the function this concept is called as Function with arguments <script type="text/javascript"> function fun1(x,y){ var z= x+y alert(z); }     </script> <input type="button" value="click" onclick="fun1(10,20)&qu