Search This Blog

14 January 2018

Javascript for beginners and advanced Concepts

JAVASCRIPT
What is Javascript?
Javascript is a Scripting Language and Programming Language  JavaScript was introduced in 1995.it’s execute  within a browser  ,Javascript code is embed in HTML webpage. <script> tag is used to javascript code.

Different type Javascript code embedded in
    Using head tag
   Using Body tag

    Using External script

Head Tag Embed in:
<html>
<head>
<script type=”text/javascript”></script>
</head>
<body>
</body>
</html>

External Script:
<html>
<head>
<script src=”external.js”></script>
</head>
<body>
</body>
</html>

Body Tag Embed in:
<html>
<head>
</head>
<body>
<script type=”text/javascript”></script>
</body>
</html>

Javascript Function:

Function is a keyword name of Function . set open and close  Parantheses enclose with parameter and without parameter and the curly braces

<html>
<head>
<script>
function sum(a,b)
{
return  a*b;
}
</script>
</head>
<body>
<script>
document.writeln(sum(10,10));
</script>
</body>
</html>

JAVASCRIPT ELEMENTS
  Ø Variables
  Ø Objects
  Ø Operators
  Ø Statements
  Ø Function and Methods
   Variables:
    Variable is also called  Identifier. Variables are Containers for Storing Data or Information.

    Rules for Variables

    Starting first  letter  or Underscore Character
    Do not use Numbers
    Javascript is a Casesensitive
    Variable is a assigned with = operator

    Scope of Variables:

  Ø Local
  Ø Global

    Local:

    A variables is declared inside a method is called local variables. Only access within function

Ex:
<html>
<head>
<title> sum </title>
<script>
function sum(){
var a=10;
var b=20;
var c=a+b;
alert(c);
}
</script>
</head>
</html>

    Global:

   Global variables is  access anywhere in the page .once declared global variable
   Access with function or without function

Ex:
<html>
<head>
<title> add </title>
<script>
Var a,b;
function sum(){
 a=10;
 b=20;
var c=a+b;
alert(c);
}
</script>
</head>
</html>

DATA TYPES

    Numbers  => Integer and Floating Points  1 or 1.0

    Booleans => Boolean is True or False and 0 0r 1

   Strings =>    String is a Sequence of Character " hello world "

    Objects =>  Represent elements of html page

    Null =>     No values is assigned or empty values 

JAVASCRIPT USING GET CURRENT LOCATION

d       Reffer This Site To get API key:

https://developer.here.com 
Then Go to This Site Create Account and Login , And this website gave a API and Code to use
Example

 <script src="https://js.api.here.com/v3/3.0/mapsjs-core.js" type="text/javascript" charset="utf-8"></script>
        <script src="https://js.api.here.com/v3/3.0/mapsjs-service.js" type="text/javascript" charset="utf-8"></script>
<script>
 
 var platform = new H.service.Platform({
                "app_id": "Your APP ID",
                "app_code": "Your APP Code"
            });
            var geocoder = platform.getGeocodingService();
            if(navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(position => {
                    geocoder.reverseGeocode(
                        {
                            mode: "retrieveAddresses",
                            maxresults: 1,
                            prox: position.coords.latitude + "," + position.coords.longitude
                        }, data => {
                            var cty=data.Response.View[0].Result[0].Location.Address.City;
                       
                             window.location.href='https://localhost/demo/index.php?city='+btoa(cty);
                        }, error => {
                            console.error(error);
                        }
                    );
                },err =>{
                    let e=err.code;
                    if(e==1){
                       ;
                         Swal.fire({
  title: 'You Denied The Location',
  text: 'Allow the Location',
  type: 'error',
  confirmButtonText: 'Allow'
}).then((e)=>{
   alert('denied location');
  });
if(navigator.geolocation){
     if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
  } else {
   navigator.geolocation.getCurrentPosition(showPosition);
  }
}
})








);
            } else {
                console.error("Geolocation is not supported by this browser!");
            }
    
</script>








09 January 2018

Basic HTML Elements



                   HTML  HYPER TEXT MARKUP LANGUAGE
       
What is HTML?

        HTML is a Standard Markup Language  used to Creating  webpage and webapplication.HTML was created by Berners-Lee  in 1991 . The Standard HTML was Published  by  1995


Advantage of  HTML?

        Easy to use and Learn

       Support all Browser

       Any One Can Edit

   Fast to Download

Basic Syntax:

<html>

<title>HTML</title>>

</head>

</head>






HTML TAGS AND  DESCRIPTION
Document OutLine:
<!Doctype>  Version of html
<html>   HTML document
<head>  Page information
<body>  page contents
<title>   page Title


Comments:
<!--  Comment text-->





Lists:
<ol>   Orderd List
<ul>   Unorderd list
<li>  List Item
<dl> Definition List
<dt>  Definition Term
<dd> Term Description
Objects:
<objects>  Object
<param/>   Parameter
Page Information:
<base>   base url
<meta>  Meta data
<title> title
<limk> Relevant Resources
<style> Style Resources
<script> Script Resources
Texts:
<p> - Paragraph
<span> --> text content
<label>  --> text the body content or else
<pre> --> 
Forms: 
<form>Form
<Fieldset> Collection of fields
<legend> form legend
<label> input label
<input> form  input
<select> drop down
<optiongroup> group of options
<textarea> large text input
<button> button

Tables:
<table>ètable
<caption>ècaption
<thead>èTable header
<tbody>ètable body
<tfoot>ètable footer
<colgroup> columngroup
<col> column
<tr> table row
<th> header cell
<td> table cell

Empty Elements:
<area>
<base>
<br>
<hr>
<img>
<input>
<link>

Content Editable Attribute and Add the placeholder Attribute For Text Elements like span,label,div,p:

.fname[contentEditable][placeholder]:empty::before{
  content: attr(placeholder);
  color: #38a7e4;
}


[contentEditable][placeholder]:empty::before{
  content: attr(placeholder);
  color:gray;
}
[contentEditable][placeholder]:focus::before{
opacity: .2;
cursor: text;
}

 @media print {

    body {

      font-size: 10pt;

    }

    a[href]:after {

      content: none !important;

    }

    .pagebreak {

      page-break-before: always;

    }

    .background-card h4:not(:first-child) {

      margin-top: 0 !important;

    }

    .card {

      border: 0;

      padding: 0;

    }

    .container {

      max-width: 100%;

      width: 100%;

    }

    .contact-details .detail .icon {

      color: #888 !important;

    }

    .background-card h4 {

      padding-bottom: 0.5em;

      margin-bottom: 0.5em;

      margin-top: 1em !important;

    }

    h4 > .fa {

      display: none !important;

    }

    .card-nested {

      padding: .5rem 0 .5rem 0;

    }

    .labels {

      display: inline;

    }

    .skill-info {

      margin-left: 0;

    }

    blockquote {

      font-size: 100%;

    }

  }









Jquery or Javascript Start Exam Time

 <script> function startTimer() {      var date = "<?php echo $date ?>"; // dynamic date      var time = "<?...