Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Friday, 14 August 2020

What is JavaScript ? and it's Syntax .

 

What is Javascript ?

Javscript is high lavel, interpreted programming language use to make  webpages  more intractive.

Javascript is scripting language that enables to create dynamic webpage and websites .It enables to controle mult-media ,animated images , etc.

It is an interpreted programming language with object oriented capabilities . 

Javascript  first known as LiveScript , but but Netscape changed its name to  JavaScript, possibly because of the excitement being generated by JAVA.

JavaScript made its first appearance in Netscape 2.0 in 1995 with the name LiveScript.

  • Javscript is lightweight programming language 
  • Javscript is have a object oriented capabilities
  • Design for creating network-centeric applications 
  • open and cross platform 

Javascript is a  client side scripting language

 

A client side scripting is common form of the language.The Script should be included refrenced by an HTML document for the code to be interpreted by Browser .

It means that a web page need note be a ststic HTML, but can included program, that interact with the user, control the browser and dynamically create HTML document .

The JavaScript client - side mechanism provides many advantages over traditional . CGI server side scripts.For example , you might use Javascript to check if the user has  entered a valid e-mail address in a form field .

The JavaScript code is executed when the user submits the form , and only if all the enteries are valid, they would be submitted to the web server.

JavaScript can be used to trap user-initiated events such as button clicks , links navigation, and other actions that the user initiates explicitly or implicity.


Advantages of JavaScript

1.Less Server interaction :- You can velidate user input before sending the page of to the server. This saves server traffic,which means less load on your server.
 

2.Immediate Feedback to visitors :- They don't have to  wait for a page reload to see they have forgot to enter something .

3.Increassed interactivity :- You can create interfaces that react when the user hovers over them with a  mouse or activates them via a keyboard.

4.Richer interfaces :- You can use JavaScript to include such items as drag-and-drop componentes or sliders to give a rich  interface to your site visitors 


Simple Syntax Of JavaScript

JavaScript can be implimented using JavaScript starments that are placed within the <script>......</script> HTML tags in a web page .

You can place the <script> tags,containing your JavaScript, anywhere within you web page, but it is normally recommnded that you  should keep it within the <head> tags.

The <script> tag allerts the browser to program to start interpreting all the text between these tags as a script. A simple syntax of your JavaScript will appeare as follows.

-----------------------------------------------------------------------------------------------------------------------------
<script....>                                                                                  
                                                                                                   
             JavaScript code 

</script>
-----------------------------------------------------------------------------------------------------------------------------

So your JavaScript syntax will look as follows.

<script language="JavaScript" type="text/JavaScript">
JavaScript code 
</script>

So your JavaScript syntax will look as follows.
  • Language :- This attribute specifies what scripting language you are using . Typically, its value will be javascript. Although recent versions of  HTML(and XHTML, its successor) have phased out the use of this attribute.
  • Type :- This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".


JavaScript are write in two ways :-
  • Internal JavaScript
  • External JavaScript

1.Internal JavaScript :-
  
  JavaScript code placed in the head and body section in HTML documents this are called a internal JavaScript.

ex.:-

<html>
<head>
        <script type="text/javascript">
                             javascript code
        </script>
</head>
<body>
            <script type="text/javasript">
                                          javascript code 
            </script>
</body>
</html>




2.External JavaScript :-


As you begin to work more extensively with JavaScript , you will be likely to find that there are cases where you are reusing identical JavaScript code on multiple pages of a sites

You are note restricted to be maintaining identical code in multiple HTML files. The script tag provides a mechanism to allow you to store JavaScript in an external file and then include it into your HTML files.

Here is an example to show how you can include an external JavaScript file in
your HTML code using script tag and its src attribute.




<html>
<head>
            <script type="text/javascript" src="file.js"> 
            </script>
</head>
<body>


</body>
</html>
    

Friday, 24 July 2020

If I am using link tag in the head part of my HTML web page which method of CSS I am applying to my webpage ?

If I am using link tag in the head part of my HTML web page which method of CSS I am applying to my webpage ?


Hello Guys Welcome my Website today i will solve a qustion to   if you using link tag in the head part of your HTML webpage so which  method of CSS are applying by you on your webpage ?  and also discuss about how to link a CSS file with HTML page  ?
So lets start

1.what is CSS ?

CSS stand for Cascading Style Sheets .CSS is a style sheet language used for describing a prasentation of document written in markup language like HTML.
A CSS is a cornerstone technology of the World Wide Web ,Alongside HTML and Javascript.
You can design your page through CSS. and dyanamicaly .

 

2.How CSS use ?

CSS are using in two type igther you are creating external CSS or internal CSS.
1.Internal CSS
2.External CSS

How to Link a Style Sheet (CSS) File to Your HTML File

Embedding CSS rules to HTML can be time-consuming and energy-wasting. Luckily for you, there is another way to do it. Here, we’ll uncover how to link CSS to HTML file. By using the following method, you’ll get to combine both CSS and HTML in the most efficient way.
CSS is a style sheet language that manages the website’s visual representation. Commonly used with markup languages like HTML, CSS allows you to style each HTML element and give your overall site a more appealing look.
While there are many ways to add CSS to HTML, the simplest method of doing it is by adding all the CSS rules to the HTML directly. Despite so, this CSS method carries many disadvantages. Aside from bloating your code with repetitive CSS rules, its editing process is time-consuming as changes made in one file won’t apply to the others.
To avoid these hassles, you can put the CSS styles into a .css file and link it to the HTML files. That way, one CSS file can be used to style many HTML pages.
Here are the advantages of linking a CSS file to HTML:
  • Time-effective — you only need to create a single CSS file to style all HTML files.
  • Faster load time — the site will cache the CSS file for your visitors’ next visit.
  • Improve SEO — storing CSS styles in another file makes the HTML file more concise and readable by search engines.

3.How to Connect a CSS External Style Sheet to HTML File


To link CSS to HTML file,we use the <link> tag , that write in HTML's <head> Section .Look like this

<html>
<head>
<link>     </link>
</head>
<body>
body of code..........................................
</body>
</html>


Ectually a <link> are written of this type
<link rel="stylesheet" type="text/css" href="stylesheet.css" media="screen"/>

  • rel — defines the relationship between the file that hosts this command and the file defined in the href attribute. The standard value for this attribute is stylesheet.
  • type — defines the content of the linked file. In this tutorial, we set this attribute’s value to text/css. However, you can skip it altogether if you’re using HTML5.
  • href — specifies the location of the CSS file you want to link to the HTML. If the CSS file is in the same directory as the HTML file, you only need to enter the file name. Otherwise, you need to include the folder name in which you store the CSS file (example: CSS/stylesheet.css).
  • media — specifies the type of media the CSS rules are optimized for. In this tutorial, we use the screen value to imply its use for computer screens. If you want to apply the CSS rules to printed pages, you can set the value to print.