1. Page
2. Form
3. Cookies
- Cookies in JavaScript
- Cookies in ASP
- Cookies in PHP
- Cookies in C#
4. Tooltip
HTML is language used do display pages in Internet browsers.
HTML specification
HTML 4 definition (DTD)
HTML Examples on W3 Schools
siteexperts.com
1. Page
Code example:Simple html page
HTML <!--- this is a comment --> <html> <head> <title>Simple page</title> </head> <body> Paragraph 1 <p> Paragraph 2 <p> <!--- list --> <ul> <li>item 1</li> <li>item 2</li> </ul> <!--- link --> <a href="http://www.devarchweb.net">www.devarchweb.net</a><br> <!--- image --> <img src="myphoto.jpg" /> <!--- table --> <table border="1"> <tr> <td>cell 1</td> <td>cell 2</td> </tr> <tr> <td>cell 3</td> <td>cell 4</td> </tr> </table> </body> </html>
2. Form
thesitewizard.com
Code example:Html form with controls
The code below shows a form that contains all most used element types and when user click on the Submit form
then form_response.htm will be called.
HTML <FORM action="form_response.htm" method="post"> <INPUT type="radio" value="red" name="color" >Red <INPUT type="radio" value="blue" name="color" checked>Blue <INPUT type="radio" value="green" name="color">Green <br> <input type="checkbox" name="quick" value="yes" checked>Expedite<br> <select name="comboOptions"> <option value="opt1">Option 1</option> <option value="opt2" selected>Option 2</option> </select><br> <select name="listOptions" size=2 multiple> <option value="item1">Item 1</option> <option value="item2" selected>Item 2</option> </select><br> Name: <input type="text" name="firstName"> <input type="button" onclick="alert("Name selection not implemented") value="Select name"> <button type="button" onclick="alert("Name selection not implemented")">Select name</button> <br> <br> Password: <input type="password" name="pwd"><br> <br> <INPUT type="submit" value="Submit form"> </FORM>
3. Cookies
Allows to store information in the browser that may be used next time when user visit the same site to display the content based on his last preferences.
- size up to 4k
- if domain is specified, valid for all files under an URI path e.g. http://mysite.net/folder1/
- to update cookie, just overwrite it value
- to invalidate cookie, set its expiration date to past
Cookies can be manipulated on the client side from JavaScript or on the server side from ASP or PHP.;
Enable cookies in IE
Cookies in JavaScript
Code example:Cookies
JavaScript // Create 1 day valid cookie document.cookie = "myKey=myValue + "; max-age=" + 60*60*24 + "; path=/" + "; domain=devarchweb.net"; // get all cookies var allCookies=document.cookie; function getOneCookie(myKey) { var searchKey = myKey + "="; var cookies = document.cookie.split(';'); // creates array of all cookies from "myKey1=myValue;myKey2=myValue2" for(var i=0; i<cookies.length; i++) { var cookie = cookies[i].trim(); if (cookie.indexOf(searchKey)==0) return cookie.substring(searchKey.length, cookie.length); } return ""; }
Cookies in ASP
ASP Write cookie <% Response.Cookies("myKey")="myValue" Response.Cookies("myKey").Expires=#June 16,2015# %> Read cookie <% myValue=Request.Cookies("myKey") %>
Cookies in PHP
PHP Write 1 day valid cookie <? setcookie("myKey", "myValue", time()+60*60*24); ?> Read cookie <? if (isset($_COOKIE["myKey"])) myValue = $_COOKIE["myKey"]; ?>
Cookies in C#
C# System.Web.HttpCookie cookie = Request.Cookies.Get("myKey"); if (cookie!=null) { var value = cookie.Value; }
4. Tooltip
HTML <div title="Tooltip text">hello</div> <span title="Tooltip text">hello</span>