DHTML
DHTML
DHTML
Dynamic hypertext markup language Html+scripting = dhtml
Vb script
java script
By using this concept we can change data at run time. Here dynamic means changeable. The main importance of this concept we can store data in backend. Here we are using back end as oracle, ms-access sql FoxPro and my sql To work this concept we are is img a tag <script>
Properties of <script>
For specify the object name at which you are writing a script Syn: - For = control name Event which event you want to apply for an object. Syn:- Event = type of event Language:- on which language you write a code. Syn:- language= language name Note :- in <script> the default language is java script
Function Declaration:- in Vb script we are using 3 types of function declarations 1 syn:<script language=language name For=control name Event=type of event > Execute statements </script>
Example of Method 1
show
<html> <body> <input type=text name=t1> <input type=button name=b1 value=show> <script language=vbs for=b1 event=onclick> T1.value=date
Example of Method 2
<html> <body> <input type=text name=t1> <input type=button name=b1 value=show> <script language =vbs> Sub b1_onclick() T1.value=now End sub </script> </body> </html>
Example of method 3
<html> <body> <input type=text name=t1> <input type=button onclick=aa() value=show> <script language=vbs> Sub aa() T1.value=date End sub </script>
</body> </html>
Variable declaration
In Vb script to declare a variable we are using a word dim Syn:- dim variable 1, variable 2.
Example
<html> <body> <input type=text name=t1> <input type=button name=b1 value=show> <script language =vbs> Sub b1_onclick() Dim a,b,c A=90 B=80 C=a+b T1.value=c End sub </script> </body> </html>
Onclick it files when the user click the mouse button at single time Ondblclick it files when the user click the mouse button two times. Onmousemove we can move the data depending upon the mouse pointer Mouseover it files when the mouse pointer is on the control Onmouseout it files when the mouse pointer is leave from the control Onkeypress it files when the user press the key of keyboard Onmouse up it files when the user release the mouse button Onmouse down it files when the user press the mouse button Window _onload it files when the page is loaded Window _onunload it files when the page is closed Onchange it files when the user change the data from control Onfocus it files when the cursor is get into the control Onblur it files when the cursor is leave from the control Working with input and output statements. Input statement: - in vb script we are using 2 types of input statements
They are Controls Input box Controls Syn:- <input type=control name Name=address Id=address>
Input box statement:- here we can enter the value in a particular variable with the help of
separate window Syn: Variable=inputbox (prompt,title,default value,x-pos,y-pos)
Working with operators Arithmetic operators +,-,*, /, mod Assignment operator Comparison operators = - <,>, <=,>=, =, <>, not equal to
In vb script we are using 5 types of conditional statements 1 if 2 if then else 3. Else if 4. Nested if 5. Select statements.
1.if statement Syn:- if condition then Execute statement End if If then else Syn:- if condition then Execute statement Else Execute statement End if Nested if Syn:- if condition then Excute statement If condition then Execute statements
Else Execute statements End if ------------Else Execute statements End if Select statement Syn:- select case variable Case value: Execute statements Case value: Execute statements -----------------------------Case else Execute statements End select
Loop:- it execute the sequence of statements until the condition has not been satisfied. In vb script 3 types of looping statements are available they are
While Syn:- while condition Execute statements Inc/dec Wend For For variable= starting value to ending value [step value] Execute statements Next If execute the sequence of statements from starting point to ending point Default step value is 1
Do while
10
Syn:- do while condition Executes statements Inc/dec [exit do] loop Working with functions
In vb script we are using 2 types of functions they are Pre defined functions User defined functions Pre defined function:- pre-defiend functions are mainly divided into 3 types Numerical functions String functions Date functions Numerical functions Abs Mod Sqr Round Sign Cos Tan Log String functions Len:- to display the length of a string
11
Strreverse:- to display in reverse format Left:- to display the left most characters Right:- to display the right most characters Mid:- to display the starting point to ending point Lcase:- to display in lowercase Ucase:- to display in upper case Char :- to display the character of given ascii value Asc:- to display the ascii value Replace: - it replace the particular character in the string String:- display the character up to n numbers
Java script It is a default scripting language in html page Syn:<script language=jscript or java script> Function declaration:- in java script we declare a function by using a following syntax
Vb script
java script
12
Variable declaration Dim Function declaration Sub control _event () Exe statements End sub } To convert the string Cint Concatenation & Inc/dec operators I=i+1 / i=i-1 Logical operators And , or, <> (not) Comparison operator = Input statements Controls Input box Output statements Msgbox Alert window Arthmatic operators +,-,*,/, mod +,/,*,/,% alert window document.write controls prompt == &&,||,!= i++,i- + parseInt function control name.event() { exe statements var
13
Array declaration Dim variable name (size) Comment , // multiple lines var var name=new (size)array
Working with switch statement Syn:Switch (variable) { Case value 1: Execute statements Break Case value 2 : Execute statement Break -------------Default : Exe statements }