corecodeschool.blogspot.com: October 2016

Enter Keyword Hear for Search This Blog

Tuesday, 11 October 2016

what is ajax?how to create ajax with php code

Ajax Introduction

- એજેક્સ નો ઉપીયોગ કરી ને તમે પેજ લોડ કાર્ય વિના બધી માહિતી મેળવી શકો.એજેક્સ થી તમે કોઈ પણ ડેટા ઝડપ થી મેળવી શકો છો

- अजाक्स का उपियोग करके आप कोई भी डाटा स्पीड में ले सकते हे और इसकी प्रोसेस प्रोसेसबार में नहीं दिखती अजाक्स अपने डाटा सर्वर को सेंड करते समय सेकुएंस मेन्टेन नहीं करता इस लिए हम डाटा फ़ास्ट एक्सेस कर सकते हे

- Ajax stands for Asynchronous JavaScript and XML. Ajax isn’t a technology; it mixes well-known programming techniques in an uncommon way to enable web developers to build Internet applications with much more appealing user interfaces.


- 
The parts of an Ajax application that happen "under the hood" of the browser, such as sending server queries and dealing with the returned data, are written in JavaScript, and XML is a means of coding and transferring formatted information used by Ajax to efficiently transfer data between server and client.

-  You cannot make use of the XMLHTTPRequest until you have created an instance of it.

-Microsoft first introduced the XMLHTTPRequest object, implementing it in Internet Explorer 5 as an ActiveX object. 


- The following line creates an XMLHTTPRequest object called request

               var request = new XMLHTTPRequest(); 
-  Here we have declared a variable request and assigned to it the value returned from the statement
new XMLHTTPRequest(),which is invoking the constructor method for the XMLHTTPRequest object.
-  To achieve the equivalent result in Microsoft Internet Explorer, you need to create an ActiveX object.
 Here's an example
               var request = new ActiveXObject("Microsoft.XMLHTTP");
- This assigns the name request to the new object.
-  Some versions of Internet Explorer have a different version of MSXML, the Microsoft XML parser, 
installed in those cases you need to use the following instruction
               var request = new ActiveXObject("Msxml2.XMLHTTP");
- For cross Browser detection, this is the following code :

function ajaxFunction()
{
    var xmlhttp;
    if (window.XMLHttpRequest)
    {
      // code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
      // code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {
      alert("Your browser does not support XMLHTTP!");
    }
}

In above example create a variable named xmlhttp to hold the XMLHttpRequest object,
Try to create the XMLHttpRequest object with xmlhttp=new XMLHttpRequest(). If that fails, 
try xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"). 
This is for IE6 and IE5. If that fails too, the user has a very outdated browser, 
and will get an alert stating that the browser doesn't support XMLHTTP.

Note: The code above can be used every time you need to create an XMLHttpRequest object.
-  XMLHTTPRequest class is predefined in php
-  Ajax have a some method and properties
Method : open, send
Properties :onreadystatechange, readyState, responseText and status 

Ajax With Html demo.html

ajaxdemo.html

<script type="text/javascript">
var http = false;
if(navigator.appName == "Microsoft Internet Explorer")
{
                        http = new ActiveXObject("Microsoft.XMLHTTP");
} else
{
  http = new XMLHttpRequest();
}
function replace()
{
  http.open("GET", "test.txt", true);
  http.onreadystatechange=function()
 {
    if(http.readyState == 4)
   {
      document.getElementById('changed').innerHTML = http.responseText;
    }
 }
  http.send(null);
}
</script>
<p><a href="javascript:replace()">Replace Text</a></p>

<div id="changed">
            Hello, world!
</div>

test.txt
This is the content of test.txt

Sunday, 2 October 2016

how to use css in your website CSS stands for Cascading Style Sheets.


1. What is CSS?

CSS stands for Cascading Style Sheets.

CSS is a stylesheet language used to design and style web pages. It controls how HTML elements appear in a browser.

Using CSS, you can change:

  • Text color and font size.

  • Background colors and images.

  • Width and height of elements.

  • Margins and padding.

  • Borders and shadows.

  • Page layouts and alignment.

  • Animations and transitions.

  • Responsive designs for mobile phones, tablets, and computers.

Example: HTML creates a button, while CSS makes the button colorful, attractive, and interactive.

2. Why Do We Use CSS?

Consider a simple HTML heading:

<h1>Welcome to My Website</h1>

Without CSS, the heading uses the browser's default styling.

With CSS, you can change its color, size, and alignment.

<!DOCTYPE html>
<html>
<head>
    <title>My First CSS Page</title>

    <style>
        h1 {
            color: blue;
            text-align: center;
            font-size: 36px;
        }
    </style>
</head>

<body>
    <h1>Welcome to My Website</h1>
</body>
</html>

Output: The heading appears in blue, centered on the page, with a font size of 36 pixels.


3. Basic CSS Syntax

CSS consists of three main parts:

selector {
    property: value;
}

For example:

p {
    color: red;
    font-size: 20px;
}

Let's understand each part.

Component

Meaning

Example

Selector

Identifies the HTML element to style

p

Property

Specifies what you want to change

color

Value

Specifies the desired setting

red

Declaration

A property and its value

color: red;

Declaration block

All declarations inside { }

color: red; font-size: 20px;

Here, all paragraph (<p>) elements will have red text with a font size of 20 pixels.

Important CSS rules

  • Use { } to enclose declarations.

  • Use : between a property and its value.

  • Use ; to separate declarations.

  • CSS comments are written as /* comment */.


how create template using html5 tags



- यह पोस्ट में आप HTML5 के टैग का उपयोग करके बहुत सरलता से अपनी डिजाईन और फॉर्म बना सकते हे.
- In this post you very simply by using HTML5 tags, create your own design and form.
- આ પોસ્ટ માં તમે HTML5 નો ઉપયોગ કરી ખુબજ સરળતા થી તમારી પોતાની Design અને ફોર્મ(Form) બનાવી શકો છો.

Featured post

Contact

Contact Core Code School Core Code School shares beginner-friendly tutorials on PHP, HTML, CSS, JavaScript, Java, SQL and Ubuntu. You can...