The autofocus attribute can only be used one time in a form. It will get user's attention by "blinking" when the page opens.
<input type="text" autofocus>
HTML5 form input tags
Not all the HTML form tags are working as they should be in all the browsers. However, it is good to know what they are and hope that all the browsers will accept them soon.
- color
- date
- datetime
- datetime-local
- month
- number
- range
- search
- tel
- time
- url
- week
Go to this website for a closer look at the progress of implementing this tags in different browsers: http://www.quirksmode.org/html5/inputs.html
HTML5 - input="date"
This is a cool input type (input="date") but sadly - at the moment only limited browsers(eg. opera) are able to execute it. The other browsers will only implement it in 2014 or later.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function processData(f1,f2,f3,f4,f5,f6){
var v1 = document.getElementById(f1).value;
var v2 = document.getElementById(f2).value;
var v3 = document.getElementById(f3).value;
var v4 = document.getElementById(f4).value;
var v5 = document.getElementById(f5).value;
var v6 = document.getElementById(f6).value;
alert(v1+"\n"+v2+"\n"+v3+"\n"+v4+"\n"+v5+"\n"+v6);
// Use Ajax-PHP to send the values to server storage
// Ajax-PHP Video Tutorial - www.developphp.com/view.php?tid=1185
}
</script>
</head>
<body>
<h2>HTML5 + Javascript Date Time Form Input Types Tutorial</h2>
Date: <input type="date" name="field1" id="field1" /><br /><br />
Datetime local: <input type="datetime-local" name="field2" id="field2" /><br /><br />
Datetime: <input type="datetime" name="field3" id="field3" /><br /><br />
Month: <input type="month" name="field4" id="field4" /><br /><br />
Time: <input type="time" name="field5" id="field5" /><br /><br />
Week: <input type="week" name="field6" id="field6" /><br /><br />
<input type="button" onClick="processData('field1','field2','field3','field4','field5','field6')" value="Submit" />
</body>
</html>
HTML5 input="search"
HTML5
Now I am reading - HTML 5, Designing Rich Internet Applications by Matthew David. On one hand I am delighted that HTML 5 has added many cool and useful tags/ commands like <input type="email">, on the other, I am a bit disappointed that they have "dropped" some of the older codes like <center> and <frames>. I will post some of cool tags/ commands found in HTML5.
Manipulating PHP strings
- Strip out white spaces from either side of the string: trim(string);
- Make sure that the first character is uppercase (eg. People's name): ucfirst(string);
- Search for the first occurence of a string: strpos(string, pattern to match);
- Search for the last occurence of a string: strrpos(string, pattern to match);
- Search and replace a string: str_replace(string to search for, string to replace with, string/message);
- Compare two strings. If the strings do not match then a non-zero value will be returned. If both strings match then a zero is returned: strcmp(string1, string2);
- Split a string into an array. To be able to split a string into an array, there must be a separator. the space ' ' is the most common but for eg. files, the separator could be a tab or a colon: explode (string separator, string); explode(":", $passwd_line);
- Convert new lines to HTML <br> tag: nl2br(string);
Learning PHP and MYSQL
Thanks to "Create Dynamic Web Pages Using PHP and MYSQL" by David Tansley for teaching me the basics of PHP and MYSQL.
Subscribe to:
Posts (Atom)
