Posts

Differences between Html4 and Html5

HTML5 has several goals which differentiate it from HTML4. The primary one is  consistent, defined error handling . As you know, HTML purposely supports 'tag soup', or the ability to write malformed code and have it corrected into a valid document. The problem is that the rules for doing this aren't written down anywhere. When a new browser vendor wants to enter the market, they just have to test malformed documents in various browsers (especially IE) and reverse-engineer their error handling. If they don't, then many pages won't display correctly (estimates place roughly 90% of pages on the net as being at least somewhat malformed). So, HTML5 is attempting to discover and codify this error handling, so that browser developers can all standardize and greatly reduce the time and money required to display things consistently. As well, long in the future after HTML has died as a document format, historians may still want to read our documents, and having a complet...

What is Html5

Introducing HTML5 HTML5 introduces a number of new tags and makes several others obsolete. That doesn’t mean an earlier version, such as HTML4.01, won’t display properly in the latest web browsers, as they all have excellent backwards compatibility. However, you should swap obsolete tags for their HTML5 alternatives. If you’ve already built a website, you should be familiar with using <div> to define a block on the page, which you can then style, up using CSS. This has been retained in HTML5, along with <span> (to pick out inline blocks for individual formatting) and joined by specific block types including <nav>, which is used to define a navigation element, such as a menu. Many new tags help to define the content of a page rather than just position it within the flow. For example, <figure> ties an image to its caption, let ting you style the pair as a single block and to sub-style the contents- image and caption – individually inside it. Even if you don’t...

Php and Javascript Cookies

Set cookie through PHP and get through JavaScript <?php //Page: set_cookie.php //$_SERVER['HTTP_HOST'] = 'http://www.webduos.com '; // localhost create problem on IE so this line // to get the top level domain $myDomain = ereg_replace('^[^\.]*\.([^\.]*)\.(.*)$', '\1.\2', $_SERVER['HTTP_HOST']); $setDomain = ($_SERVER['HTTP_HOST']) != "localhost" ? ".$myDomain" : false; setcookie ("site", 'http://only-your-views.blogspot.com', time()+3600*24*(2), '/', "$setDomain", 0 ); // You can change (2) to any negative value (-2) for deleting it. It is number of days for cookie to keep live. Any -ve number will tell browser that it is useless now. ?> Page: get_cookie.html <script> function readCookie(name) { var cookiename = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' '...

Slider Navigation using Jquery

Html Structure The only thing we will need for the navigation is a simple unordered list with links inside of the list elements: <ul id="navigation">  <li class="home"><a title="Home"></a></li>  <li class="about"><a title="About"></a></li>  <li class="search"><a title="Search"></a></li>  <li class="photos"><a title="Photos"></a></li>  <li class="rssfeed"><a title="Rss Feed"></a></li>  <li class="podcasts"><a title="Podcasts"></a></li>  <li class="contact"><a title="Contact"></a></li> </ul> The list is getting an ID because we want to refer to it later in the JavaScript. With jQuery, we will make the link items slide out whenever we hover over the ...

How to Create Custom Ajax Tabs with Jquery

HTML : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />      <title>Tabs Demo</title>      <link rel="stylesheet" href="./main.css" />      <script type="text/javascript" src="./jquery-1.3.2.min.js"></script>      <script type="text/javascript" src="./main.js"></script> </head> <body>      <div id="page">           <ul id="tabs">                <li><a href="./tabs/tab-1.html">Tab 1</a></li>                <li><a href="./tabs/tab-2.html">Tab 2</a></li>   ...

Input Validation Using Filter Functions

The filter_input() function was introduced in PHP 5.2.0 and allows you to get an external variable by name and filter it. This is incredibly useful when dealing with $_GET and $_POST data. Let’s take as an example a simple page that reads a value passed in from the URL and handles it. We know this value should be an integer between 15 and 20. One way of doing would be something like: <?php if (isset($_GET["value"])) { $value = $_GET["value"]; } else { $value = false; } if (is_numeric($value) && ($value >= 15 && $value <= 20)) { // run my code } else { // handle the issue } This is a really basic example and already we are writing more lines that I would like to see. First, because we can’t be sure $_GET is set, the code performs an appropriate check so that the script doesn’t fall over. Next is the fact that $value is now a “dirty” variable because it has been directly assigned from a $_GET value. We would need to take...

Jquery Table Sorter

To use the tablesorter plugin, include the   jQuery   library and the tablesorter plugin inside the   <head>   tag of your HTML document: <script type="text/javascript" src="/path/to/jquery-latest.js"></script> <script type="text/javascript" src="/path/to/jquery.tablesorter.js"></script>   Tablesorter works on standard HTML tables. You must include THEAD and TBODY tags: <table id="myTable" class="tablesorter"> <thead> <tr>     <th>Last Name</th>     <th>First Name</th>     <th>Email</th>     <th>Due</th>     <th>Web Site</th> </tr> </thead> <tbody> <tr>     <td>Smith</td>     <td>John</td>     <td>jsmith@gmail.com</td>     <td>$50...