Monday, 23 May 2011

Learn PHP online : PHP Day-34

Java Script

                                        

 Before going to learn Java Script we need to know some things about the Java Script!
*Java script is client side scripting language. Java Script was implemented by Netscape Corporation in 1995 as “live Script”.
*java script executes in client system with help of web browser. We are using java script in web applications to decrease the network traffic and to increase the application performance.
*By using Java Script we can validate the input controls. We can also implement the client side games and azax functionalities.
*client side script is unsecure, users can easily see the logics what we implemented.
*Java Script is case sensitive language. Every statement in Java Script we should end with semi column (;). But it is optional.
*Java Script is loosely typed language. That’s why we need to provide the data types to the variables (at the time of variable declaration). We need not to worry about the type conversations.
*Java Script code should be including within the script declaration style tags.
*Java Script is default client side script of all browsers. Every browser can execute the Java Script.
 
JavaScript designed to add interactivity to HTML pages.
Is a scripting language (a scripting language is a lightweight programming language).
JavaScript code is usually embedded directly into HTML pages.
JavaScript is an interpreted language (means that scripts execute without preliminary compilation).

Features:

JavaScript gives HTML designers a programming tool.
JavaScript can put dynamic text into an HTML page.
JavaScript can react to events.
JavaScript can read and write HTML elements.
JavaScript can be used to validate input data.
JavaScript can be used to detect the visitor's browser.
JavaScript can be used to create cookies.

JavaScript code in HTML page:

Use the <script> tag (also use the type attribute to define the scripting language)
<html>
<head>
<script type="text/javascript">
...
</script>
</head>
<body>
<script type="text/javascript">
...
</script>
</body>
</html>
Scripts are placed at

• Scripts can be in the either <head> section or <body> section
• Convention is to place it in the <head> section
<html>
<head>
<script type="text/javascript">
....
</script>
</head>

 
 
 

No comments:

Post a Comment

Visual comparison of the two methods, creating a simple table.

Option 1, using PHP: // PHP $html = '<table>' ;     foreach ( $data as $row ) {     $html .= '<tr>...