<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Script Tutorials &#187; Script Tutorials, Web Development and other scripting</title> <atom:link href="http://www.script-tutorials.com/author/admin/feed/" rel="self" type="application/rss+xml" /><link>http://www.script-tutorials.com</link> <description>Tutorials for Web Developers</description> <lastBuildDate>Fri, 03 Feb 2012 06:07:51 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Infographic: The Evolution of Languages</title><link>http://www.script-tutorials.com/infographic-the-evolution-of-languages/</link> <comments>http://www.script-tutorials.com/infographic-the-evolution-of-languages/#comments</comments> <pubDate>Fri, 03 Feb 2012 06:07:51 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[resources]]></category> <category><![CDATA[Infographic]]></category> <category><![CDATA[languages]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1414</guid> <description><![CDATA[Infographic: The Evolution of Languages Information Graphics (known as infographics) are a best way to transfer new information into a reader&#8217;s mind. Nowadays many people don&#8217;t have enough time to read a lot of text on multiple screens. Infographics makes the information intuitive and understandable. That&#8217;s why we would like to share the best relevant [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4>No related posts.</div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="The Evolution of Languages" src="http://www.script-tutorials.com/demos/infographics/evol_thumb.png"></div><p><strong>Infographic: The Evolution of Languages</strong><br
/> <br
/> Information Graphics (known as infographics) are a best way to transfer new information into a reader&#8217;s mind. Nowadays many people don&#8217;t have enough time to read a lot of text on multiple screens. Infographics makes the information intuitive and understandable. That&#8217;s why we would like to share the best relevant infographics from all over the web. Today I found a first one related infographic on the evolution of programming languages. It covers most of languages, and I sure it will very interesting for you.<br
/> <span
id="more-1414"></span></p><hr
/> <img
src="http://www.script-tutorials.com/demos/infographics/evolution-computer-languages_sm.png" alt="The Evolution of Languages" /></p><hr
/><h5 style="text-align: center;"><strong><a
title="The Evolution of Languages" href="http://www.script-tutorials.com/demos/infographics/evolution-computer-languages.png" target="_blank">Large version</a></strong></h5><p><strong>Original source: <a
target="_blank" href="http://www.rackspace.com/cloud/blog/2011/05/17/infographic-evolution-of-computer-languages/" rel="nofollow">Evolution of Computer Languages</a></strong></p><div
class="shr-publisher-1414"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><p>No related posts.</p></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/infographic-the-evolution-of-languages/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>12 Unique Navigation Menu Designs For Your Inspiration</title><link>http://www.script-tutorials.com/12-unique-navigation-menu-designs-for-your-inspiration/</link> <comments>http://www.script-tutorials.com/12-unique-navigation-menu-designs-for-your-inspiration/#comments</comments> <pubDate>Thu, 02 Feb 2012 14:33:07 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[resources]]></category> <category><![CDATA[Designs]]></category> <category><![CDATA[inspiration]]></category> <category><![CDATA[navigation menu]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1410</guid> <description><![CDATA[12 Unique Navigation Menu Designs For Your Inspiration During creating new website &#8211; one of the main things that you have to create &#8211; is the CSS menu (navigation). In order to have own unique menu, there&#8217;s a necessity for some developing. However this can be difficult and take much time to start from zero [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/css3-green-marble-menu/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/179/thumb.png" alt="Creating a Marble Style CSS3 Navigation Menu" /> Creating a Marble Style CSS3 Navigation Menu</a></li><li> <a
href="http://www.script-tutorials.com/10-most-creative-jquery-navigation-plugins/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/108/thumb.png" alt="10 Most Creative jQuery Navigation Plugins" /> 10 Most Creative jQuery Navigation Plugins</a></li><li> <a
href="http://www.script-tutorials.com/15-unique-and-creative-layouts-2011/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/219/thumb.jpg" alt="15 Unique and Creative Layouts 2011" /> 15 Unique and Creative Layouts 2011</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="12 Unique CSS3 Menus For Your Inspiration" src="http://www.script-tutorials.com/demos/229/thumb.png"></div><p><strong>12 Unique Navigation Menu Designs For Your Inspiration</strong><br
/> <br
/>During creating new website &#8211; one of the main things that you have to create &#8211; is the CSS menu (navigation). In order to have own unique menu, there&#8217;s a necessity for some developing. However this can be difficult and take much time to start from zero and to address this, you can use some ready ideas of navigation menus created by professional web-designers so that you will not have to start from scratch. All you have to do &#8211; customize them to reflect the design that you want to have. Here is fresh hand-made collection of most impressive navigation menu designs for you.<br
/> <span
id="more-1410"></span></p><hr
/><h3><a
rel="nofollow" target="_blank" href="http://captaindash.com/#the-product">1. CaptainDash</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img1.png" alt="CaptainDash" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.appgear.com/">2. APPGEAR: Amplified Reality</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img2.png" alt="APPGEAR: Amplified Reality" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.uchitomi.ch/">3. Uchitomi &#8211; Sushis</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img3.png" alt="Uchitomi - Sushis" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.jeugdraadbrakel.be/">4. Gemeentelijke Jeugdraad Brakel</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img4.png" alt="Gemeentelijke Jeugdraad Brakel" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.campluxe.com.au/">5. Online Camping Equipment</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img5.png" alt="Online Camping Equipment" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.mezcalbuenviaje.com/">6. Mezcal Buen Viaje</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img6.png" alt="Mezcal Buen Viaje" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.vlog.it/">7. vlog.it</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img7.png" alt="vlog.it" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.beetle.com/">8. Volkswagen Beetle</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img8.png" alt="Volkswagen Beetle" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.tatchies.com/">9. Tatchies</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img9.png" alt="Tatchies" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.taocommunity.com/home#">10. Tao Community</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img10.jpg" alt="Tao Community" /></p><h3><a
rel="nofollow" target="_blank" href="http://attackemart.in/">11. Martin Gauer</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img11.jpg" alt="Martin Gauer" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.tdhcreative.com/">12. Tom, Dick &amp; Harry</a></h3><p><img
src="http://www.script-tutorials.com/demos/229/img12.png" alt="Tom, Dick &amp; Harry" /></p><hr
/><h3>Conclusion</h3><p>Hope that our new collection of new creative menu designs has been interested for you. Good luck!</p><div
class="shr-publisher-1410"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/css3-green-marble-menu/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/179/thumb.png" alt="Creating a Marble Style CSS3 Navigation Menu" /> <br
/> Creating a Marble Style CSS3 Navigation Menu</a></li><li> <a
href="http://www.script-tutorials.com/10-most-creative-jquery-navigation-plugins/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/108/thumb.png" alt="10 Most Creative jQuery Navigation Plugins" /> <br
/> 10 Most Creative jQuery Navigation Plugins</a></li><li> <a
href="http://www.script-tutorials.com/15-unique-and-creative-layouts-2011/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/219/thumb.jpg" alt="15 Unique and Creative Layouts 2011" /> <br
/> 15 Unique and Creative Layouts 2011</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/12-unique-navigation-menu-designs-for-your-inspiration/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Form Validation with Javascript and PHP</title><link>http://www.script-tutorials.com/form-validation-with-javascript-and-php/</link> <comments>http://www.script-tutorials.com/form-validation-with-javascript-and-php/#comments</comments> <pubDate>Wed, 01 Feb 2012 19:17:47 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[HTML/CSS]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[forms]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[validation]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1403</guid> <description><![CDATA[Form Validation with Javascript and PHP In this tutorial, I will show you how to create an attractive, pleasant to look form for your website and then I will explain you how to dynamically validate them using Javascript. We&#8217;ll also cover server-side validation with PHP to make everything 100% safe. This tutorial will help you [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/data-validation-html5/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/49.png" alt="Data Validation &#8211; How to Validate Forms using HTML5" /> Data Validation &#8211; How to Validate Forms using HTML5</a></li><li> <a
href="http://www.script-tutorials.com/animated-photo-gallery-grid-with-javascript/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/54/thumb.png" alt="Animated Photo Gallery (grid) with javascript" /> Animated Photo Gallery (grid) with javascript</a></li><li> <a
href="http://www.script-tutorials.com/cross-browser-effect-of-waves-using-javascript/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/81/thumb.png" alt="Creating Cross-browser Compatible Wave Effects Using Javascript" /> Creating Cross-browser Compatible Wave Effects Using Javascript</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="Form Validation with Javascript and PHP" alt="Form Validation with Javascript and PHP" src="http://www.script-tutorials.com/demos/228/thumb.png"></div><p><strong>Form Validation with Javascript and PHP</strong><br
/> <br
/>In this tutorial, I will show you how to create an attractive, pleasant to look form for your website and then I will explain you how to dynamically validate them using Javascript. We&#8217;ll also cover server-side validation with PHP to make everything 100% safe. This tutorial will help you to add more functionality to your forms which leads to better user experience and better quality of your website. You may also enhance your already existing forms by adding them some fancy effects presented in this tutorial. Let&#8217;s get started! Info: If you&#8217;d like to modify already existing form by adding some javascript to it then skip HTML and CSS part of this tutorial and go to step five. Otherwise, if you&#8217;re planning to create new form start reading here.<br
/> <span
id="more-1403"></span></p><h3>Concept</h3><p>Let&#8217;s start with some brief explanation of what are we going to do. I&#8217;m sure that you&#8217;ve seen lots of different forms and I&#8217;m sure that filling in some of them was a lot more comfortable than filling in the other ones. I&#8217;m sure that this was caused in large part by some additional scripts. We&#8217;re going to cover a few field types including standard input field, password field, repeat password field, email field, options list and a few different scripts so I&#8217;m sure that you&#8217;ll find here something useful for you. Here are a few more things to consider while creating forms:</p><ul><li>Make sure that your form is as short as possible. People don&#8217;t like wasting time on filling in complex forms. They are likely to leave the page before they take any action. It&#8217;s better to ask for less important information after user is already registered (preferably only when you really need that information).</li><li>We want it to look neat and clean.</li><li>We want it to work seamlessly and without any strange behavior or errors.</li><li>We want to reduce number of fake submissions.</li></ul><h5 style="text-align: center;"><strong><a
title="Form Validation with Javascript and PHP - demo 228" href="http://www.script-tutorials.com/demos/228/index.php" target="_blank">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="Form Validation with Javascript and PHP - package" href="http://www.script-tutorials.com/demos/228/source.zip" target="_blank">download in package</a></strong></h5><hr
/><h3>Project</h3><p>We&#8217;re going to start with HTML and then improve it with styles and scripts. At the end we&#8217;re going to I&#8217;m going to use the following fields in my form (numbers of allowed chars are in the brackets):</p><ul><li>Name (25)</li><li>Password (25)</li><li>Password Confirmation (25)</li><li>Email (50)</li><li>Gender (boolean)</li></ul><p>This is mine schedule. I found the best way to make each part of web is to start with HTML and then improve it by adding some style and scripts but you can actually start with preparing database (you can have your own DB table structure) or PHP script (step 12) and then take care of the rest pieces. Tip: You can increase maximum size of your text fields if you really need it but honestly I think values I chose are good enough.</p><h3>Step 1 &#8211; HTML Forms</h3><p>Lets prepare new folder &#8216;templates&#8217;, where we will put all our templates. Create a new document and name it main_page.html. Now we&#8217;re going to create HTML form and place it there. As you can see below there are some comments referring to each part of my code so I believe that at this point additional explanations are superfluous. I have also created a HTML table to align all the information. Here&#8217;s the code:</p><h4>templates/main_page.html</h4><pre class="brush:html">
&lt;form action=&quot;index.php&quot; method=&quot;post&quot; id=&quot;form&quot; onsubmit=&quot;return validate_all('results');&quot;&gt;
    &lt;table cellspacing=&quot;10&quot;&gt;
        &lt;tr&gt;&lt;td&gt;Login&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;login&quot; maxlength=&quot;25&quot; id=&quot;login&quot; onKeyUp=&quot;updatelength('login', 'login_length')&quot;&gt;&lt;br /&gt;&lt;div id=&quot;login_length&quot;&gt;&lt;/div&gt; &lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;Password&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;password&quot; name=&quot;pass&quot; maxlength=&quot;25&quot; id=&quot;password&quot; onKeyUp=&quot;updatelength('password', 'pass_length')&quot;&gt;&lt;div id=&quot;pass_result&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div id=&quot;pass_length&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;Confirm Password&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;password&quot; name=&quot;cpass&quot; maxlength=&quot;25&quot; id=&quot;c_password&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;Gender&lt;/td&gt;&lt;td&gt;&lt;select name=&quot;gender&quot;&gt;&lt;option value=&quot;1&quot;&gt;male&lt;/option&gt;&lt;option value=&quot;0&quot;&gt;female&lt;/option&gt;&lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;Email&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;email&quot; maxlength=&quot;50&quot; id=&quot;email&quot; onKeyUp=&quot;updatelength('email', 'email_length')&quot;&gt;&lt;br /&gt;&lt;div id=&quot;email_length&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Register&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
    &lt;h3 id=&quot;results&quot;&gt;&lt;/h3&gt;
&lt;/form&gt;
</pre><p>Things to note:</p><ul><li>Don&#8217;t forget to name your text fields, otherwise you won&#8217;t be able to receive data from them later on.</li><li>Maxlength parameter reduces number of characters you can use in each text field.</li><li>Action, method and id parameters are required so place them into form tag.</li><li>You can make table border visible by placing border=&#8221;1&#8243; in table tag if you want to actually see the table.</li></ul><p>Here&#8217;s the code of second page:</p><h4>templates/step2.html</h4><pre class="brush:html">
&lt;h2&gt;{errors}&lt;/h2&gt;
&lt;form action=&quot;index.php&quot; method=&quot;post&quot;&gt;
    &lt;table cellspacing=&quot;10&quot;&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;login&quot; value=&quot;{login}&quot;&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;pass&quot; value=&quot;{pass}&quot;&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;cpass&quot; value=&quot;{cpass}&quot;&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;gender&quot; value=&quot;{gender}&quot;&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;email&quot; value=&quot;{email}&quot;&gt;
        &lt;tr&gt;&lt;td&gt;&lt;span&gt;Verification code&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;input name=&quot;vcode&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;span&gt;Hint&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;i&gt;{vcode}&lt;/i&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Register&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
&lt;/form&gt;
</pre><p>And &#8211; last one page:</p><h4>templates/step3.html</h4><pre class="brush:html">
&lt;h1&gt;Registration complete&lt;/h1&gt;
</pre><h3>Step 2 &#8211; Adding CSS</h3><p>Now we have our HTML form but it does not look attractively yet. As you may have guessed it is time to add some CSS and make our form look a little better. Here is my example of green form definitions:</p><h4>css/main.css</h4><pre class="brush:css">
form {
    background-color: #555;
    display: block;
    padding: 15px;
}
input[type=text], input[type=password], input[type=submit] {
    -moz-border-radius: 2px;
    -ms-border-radius: 2px;
    -o-border-radius: 2px;
    -webkit-border-radius: 2px;
    border-radius: 2px;
}
input[type=text], input[type=password], select {
    background-color: rgb(246, 254, 231);
    border-color: rgb(180, 207, 94);
    border-style: solid;
    border-width: 1px;
    font-size: 16px;
    height: 25px;
    margin-right: 10px;
    width: 200px;
}
input[type=submit]{
    cursor: pointer;
    font-size: 16px;
    height: 35px;
    padding: 5px;
}
input.wrong {
    border-color: rgb(180, 207, 94);
    background-color: rgb(255, 183, 183);
}
input.correct {
    border-color: rgb(180, 207, 94);
    background-color: rgb(220, 251, 164);
}
#pass_result {
    float: right;
}
</pre><p>Classes are named according to their further function. For example <b>.wrong</b> class will be used when text field contains wrong informations and so on. Also you should now add class parameter to each text field and elements that should have some style. To do it place <b>class=&#8221;class_name_here&#8221;</b> to <b>input</b> tags where <b>class_name_here</b> is name of class defined between <b>style</b> tags (see example if you are new to adding classes to elements). Add only <b>field</b> class to each text field, rest will be used later. I advise to modify styles a little by choosing different colors and values so that they could fulfill your requirements.</p><h3>Step 3 &#8211; Javascript</h3><p>This step will be about dynamic elements and how to use Javascript to create and then apply them wherever you would like to. After observing what some sites do I&#8217;ve noticed that there are plenty of such scripts (which I&#8217;m going to present here) recently, especially on big companies/corporations sites and popular services so I think this really make users happier and encourage them to fill forms in. Look around and check out some sign up forms (Google.com, Yahoo.com and flickr.com, ebay.com&#8230; yes, dynamic forms are almost everywhere now). Some easy to do scripts can reduce number of unnecessary clicks and let users create account (or whatever you are making form for) more quickly than before, not to mention they look much more prettily and cool. There are various places to put the javascript code as it was with CSS. It can either be written inside the <b>main_page.html</b> file using a tag or put to the other file and then include this file to <b>main_page.html</b>. Both case will use the same code to put scripts to your document. I chose second option so make separated script file (js/script.js) for our <b>main_page.html</b> file.</p><p>Each function from further steps should be placed where I made comment so between.</p><h3>Step 4 &#8211; Applying functions</h3><p>This is very important step so read it carefully. Adding javascript functions to your HTML form elements should be easy because it is very similar to adding CSS classes to them. Also to make it easier I tried to create functions from further steps alike to each other so that you can apply them almost the same way but for sure I will add some sample files each step to show you how it is made and I will write a little explanation to them. Generally if you want to add function (let&#8217;s say <b>updatelength()</b> from <b>Step 7 &#8211; Counter</b>) to <b>login</b> field you should replace:</p><pre class="brush:html">
    &lt;input type=&quot;text&quot; name=&quot;login&quot; maxlength=&quot;25&quot; id=&quot;login&quot;&gt;
</pre><p>with:</p><pre class="brush:html">
    &lt;input type=&quot;text&quot; name=&quot;login&quot; maxlength=&quot;25&quot; id=&quot;login&quot; onKeyUp=&quot;updatelength('login', 'login_length')&quot;&gt;&lt;br /&gt;&lt;div id=&quot;login_length&quot;&gt;&lt;/div&gt;
</pre><p>The only thing that has changed is <b>onKeyUp=&#8221;updatelength(&#8216;logid&#8217;, &#8216;login_length&#8217;)&#8221;</b> was added. Well, if we add something like this to our <b>input</b> we will observe what function is returning outcome in <b>div</b> tag with id &#8220;login_length&#8221;.</p><p><b>Why?</b></p><p>Because <b>updatelength()</b> function starts like this <b>&#8220;function updatelength(field, output){&#8230;&#8221;</b> (Step 7 &#8211; Counter) and that means it requires two arguments which are <b>ID OF TEXT FIELD IN HTML</b> and <b>ID OF DIV WHERE RESULT WILL BE</b>. Now it is easy, isn&#8217;t it? <img
src='http://www.script-tutorials.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Rest of functions are similar to this one so I hope it won&#8217;t be a problem to apply it. Each one needs almost same values as arguments.<br
/> Notes:</p><ul><li>You can use more than one function to one text field by using a separator &#8220;;&#8221;. Example: <b>onKeyUp=&#8221;updatelength(&#8216;logid&#8217;, &#8216;login_length&#8217;); valid_length(&#8216;logid&#8217;, &#8216;login_o&#8217;);&#8221;</b></li><li>Look up to the source of example sites if you have any problems.</li></ul><h3>Step 5 &#8211; Counter</h3><p>So, here goes first script to improve our sign up form. It can be used in many other cases like adding a comment or posting message somewhere so you can attach it to more than one form. It will count characters we typed and tells us how many more we can write to the end of field. Short code and useful thing:</p><pre class="brush:js">
function updatelength(field, output){
    curr_length = document.getElementById(field).value.length;
    field_mlen = document.getElementById(field).maxLength;
    document.getElementById(output).innerHTML = curr_length+'/'+field_mlen;
    return 1;
}
</pre><p>Once you have placed it, you can run it using method presented in previous step (also there is example of usage described). This script checks how many characters did you use (each time you use one) and how many are allowed by text field&#8217;s <b>maxlength</b> parameter, then it changes value between the div tags. There are 2 variables called <b>&#8216;curr_length&#8217;</b> and <b>&#8216;field_mlen&#8217;</b>. First one gets and store number of characters you&#8217;ve typed (as I already wrote each time you type something in the field) and second one stores value of maxlength parameter of the field on which you are using this function. Then it simply shows both values with &#8216;/&#8217; separator in the middle. Note:</p><ul><li>I applied this script to every field</li></ul><h3>Step 6 &#8211; Password Strength</h3><p>Now it will be something which will check for how strong the password is. Scripts like this are usually not very extended so here is the basic version of it:</p><pre class="brush:js">
function check_v_pass(field, output) {
    pass_buf_value = document.getElementById(field).value;
    pass_level = 0;
    if (pass_buf_value.match(/[a-z]/g)) {
        pass_level++;
    }
    if (pass_buf_value.match(/[A-Z]/g)) {
        pass_level++;
    }
    if (pass_buf_value.match(/[0-9]/g)) {
        pass_level++;
    }
    if (pass_buf_value.length &lt; 5) {
        if(pass_level &gt;= 1) pass_level--;
    } else if (pass_buf_value.length &gt;= 20) {
        pass_level++;
    }
    output_val = '';
    switch (pass_level) {
        case 1: output_val='Weak'; break;
        case 2: output_val='Normal'; break;
        case 3: output_val='Strong'; break;
        case 4: output_val='Very strong'; break;
        default: output_val='Very weak'; break;
    }
    if (document.getElementById(output).value != pass_level) {
        document.getElementById(output).value = pass_level;
        document.getElementById(output).innerHTML = output_val;
    }
    return 1;
}
</pre><p>As a <b>&#8216;field&#8217;</b> argument we should put an ID of field to check and in <b>&#8216;output&#8217;</b> goes place where the result will be shown. Of course DON&#8217;T TYPE IT HERE but when you are using this function (here you are only creating it) so replace values only when you write <b>OnKeyUp=&quot;&#8230;</b> in your input <img
src='http://www.script-tutorials.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Function also here contains two variables. First one called <b>&#8216;pass_level&#8217;</b> contains current password strength and it is set to 0 by default because password field is empty at the beginning. Second variable named <b>&#8216;pass_buf_value&#8217;</b> contains current value of your password field. Below those two you can see some if()-s, they are looking for some characters that may increase password strength level and if one of them find anything it updates value of <b>&#8216;pass_level&#8217;</b> variable by adding 1 to it. Of course rest of the script returns proper informations, it chooses right text depending on current <b>&#8216;pass_level&#8217;</b> value. Apply this script to your password field.</p><h3>Step 7 &#8211; Comparing passwords</h3><p>Third script compare value from password field with value from confirm password field to make user sure, he typed exactly what he wanted. Characters here are not visible so to check if user did not make any mistakes we need two different fields and both has to contain same values when typing, only then form is filled correctly:</p><pre class="brush:js">
function compare_valid(field, field2) {
    fld_val = document.getElementById(field).value;
    fld2_val = document.getElementById(field2).value;
    if (fld_val == fld2_val) {
        update_css_class(field2, 2);
        p_valid_r = 1;
    } else {
        update_css_class(field2, 1);
        p_valid_r = 0;
    }
    return p_valid_r;
}
</pre><p>Guess how to use it? Only tip I will give you is that you should use it only on the <b>compare password field</b> and nowhere else. Well, this script as you can see arrogates values of 2 fields to two different variables called <b>&#8216;fld_val&#8217;</b> and <b>&#8216;fld2_val&#8217;</b>. There is an if() construction below them which compares those two values and changes between 2 versions of style (green when everything is good and red when there are any errors).</p><h3>Step 8 &#8211; Email verification</h3><p>A bit more complicated script but usage is easy as always. Every email address must fulfill following criteria:<br
/> 1. Must have some characters at the beginning (letters or numbers (and some less important))<br
/> 2. Must have @ (at) character<br
/> 3. Must have domain name<br
/> a) Must have first word<br
/> b) Must have . (dot) character<br
/> c) Must have second word<br
/> 4. And in the event that somebody believe his email address contains big letters it must convert characters to small ones</p><pre class="brush:js">
function check_v_mail(field) {
    fld_value = document.getElementById(field).value;
    is_m_valid = 0;
    if (fld_value.indexOf('@') &gt;= 1) {
        m_valid_dom = fld_value.substr(fld_value.indexOf('@')+1);
        if (m_valid_dom.indexOf('@') == -1) {
            if (m_valid_dom.indexOf('.') &gt;= 1) {
                m_valid_dom_e = m_valid_dom.substr(m_valid_dom.indexOf('.')+1);
                if (m_valid_dom_e.length &gt;= 1) {
                    is_m_valid = 1;
                }
            }
        }
    }
    if (is_m_valid) {
        update_css_class(field, 2);
        m_valid_r = 1;
    } else {
        update_css_class(field, 1);
        m_valid_r = 0;
    }
    return m_valid_r;
}
</pre><p>Place <b>OnKeyUp=&quot;&#8230;</b> into <b>input</b> tag where email address is and create new <b>div</b> with adequate ID to make it work. This function basically looks up if the email address is typed correctly. First it arrogates value of the field to <b>&#8216;fld_value&#8217;</b> variable to work with it. Everything is supervised by 4 if() constructions. They are step by step checking if there is @ symbol (1), then if it is on the second or further position (2). At the end if there is &quot;dot&quot; character after @ symbol (3) and finally if there are any characters before and after this &quot;dot&quot; (4). If any of if()-a find error it stops script and switches to red style wrong style of field. Those if()-s are a bit complicated as you can see but finally result is same as always, it chooses between green and red style and then shows it. Second part of this script is similar to switching between two options in already explained part so it should be clear for now.</p><h3>Step 9 &#8211; Empty fields</h3><p>Short function checking if there is more than 0 characters in our inputs. If there are empty spaces somewhere we can&#8217;t create new account:</p><pre class="brush:js">
function valid_length(field) {
    length_df = document.getElementById(field).value.length;
    if (length_df &gt;= 1 &amp;&amp; length_df &lt;= document.getElementById(field).maxLength) {
        update_css_class(field, 2);
        ret_len = 1;
    } else {
        update_css_class(field, 1);
        ret_len = 0;
    }
    return ret_len;
}
</pre><p>Like usually here also we have to give a text field ID and ID of div where result of script should be as an arguments. Add this script to each field (except gender one). This one has only one interesting part to explain because rest should be clear for you already. I&#8217;m talking about this long if() construction in the third line. It first checks if value of the field has at least one character and than in its second part if it has no more than &#8216;max number&#8217; of characters. Then it just changes between two options &#8211; right and wrong.</p><h3>Step 10 &#8211; Coloring</h3><p>This one is very short and only changes mode between two classes to make better visual effects. Classes must be defined in our CSS part of document (they are if you copied definitions from step 4). I called them <b>wrong</b> and <b>correct</b>:</p><pre class="brush:js">
function update_css_class(field, class_index) {
    if (class_index == 1) {
        class_s = 'wrong';
    } else if (class_index == 2) {
        class_s = 'correct';
    }
    document.getElementById(field).className = class_s;
    return 1;
}
</pre><p>As you may have already noticed this function is ran by other ones. Previous and further scripts puts arguments here. First argument is an ID of field you are currently working with and second is number 1 or 2. This numbers are being changed depending on actual field status to let then change its style to correct one. Let&#8217;s continue to next step.</p><h3>Step 11 &#8211; Last Javascript verification</h3><p>This is the last script using javascript. It calls out every function once more for sure and returns encountered errors or allows us to continue. It does not require refreshing whole page but check form quickly after pressing &quot;Register&quot;. That&#8217;s very important script and other ones were mostly make to let this one work:</p><pre class="brush:js">
function validate_all(output) {
    t1 = valid_length('login');
    t2 = valid_length('password');
    t3 = compare_valid('password', 'c_password');
    t4 = check_v_mail('email');
    t5 = check_v_pass('password', 'pass_result');

    errorlist = '';
    if (! t1) {
        errorlist += 'Login is too short/long&lt;br /&gt;';
    }
    if (! t2) {
        errorlist += 'Password is too short/long&lt;br /&gt;';
    }
    if (! t3) {
        errorlist += 'Passwords are not the same&lt;br /&gt;';
    }
    if (! t4) {
        errorlist += 'Mail is wrong&lt;br /&gt;';
    }
    if (errorlist) {
        document.getElementById(output).innerHTML = errorlist;
        return false;
    }
    return true;
}
</pre><p>This script to work must be added to your submission form. And don&#8217;t forget to put <b>div</b> tag with &#8216;results&#8217; id somewhere so that there outcome could go (in my case it is at the bottom of form so below just made &#8216;button&#8217;). Once you press new button this function recalls other functions from previous steps and checks once more for any mistakes for sure. If everything is fine it let you create account but if something is wrong it shows errors there where you&#8217;ve placed your <b>&#8216;div&#8217;</b> with <b>&#8216;results&#8217;</b> ID. Also in this script you can define your own error messages.</p><h3>Step 12 &#8211; Final verification</h3><p>From now it will be mostly about PHP (and MySQL) so if you don&#8217;t want to make such a form on you website you can just leave it and use methods I showed in other situations <img
src='http://www.script-tutorials.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Otherwise if you would like to store account data using MySQL database continue reading.<br
/> Javascript actually doesn&#8217;t protect our database from anything, it only makes people lifes easier <img
src='http://www.script-tutorials.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> If we want to be sure that filled form is 100% correct we must use PHP verification before we can add anything to our database &#8211; that is because if somebody will turn javascript off still he can write whatever he want while creating account and this may make database errors occurs. To add some very simply PHP script create index.php file which will be launched after pressing &quot;Register&quot; button. Well, here&#8217;s the code you should put to your index.php file:</p><h4>index.php</h4><pre class="brush:php">
&lt;?php

// set error reporting level
if (version_compare(phpversion(), '5.3.0', '&gt;=') == 1)
  error_reporting(E_ALL &amp; ~E_NOTICE &amp; ~E_DEPRECATED);
else
  error_reporting(E_ALL &amp; ~E_NOTICE);

session_start();
if (isset($_POST['submit'])) {

    $sLogin = escape($_POST['login']);
    $sPass = escape($_POST['pass']);
    $sCPass = escape($_POST['cpass']);
    $sEmail = escape($_POST['email']);
    $iGender = (int)$_POST['gender'];

    $sErrors = '';
    if (strlen($sLogin) &gt;= 1 and strlen($sLogin) &lt;= 25) {
        if (strlen($sPass) &gt;= 1 and strlen($sPass) &lt;= 25) {
            if (strlen($sEmail) &gt;= 1 and strlen($sEmail) &lt;= 55) {
                if ($sPass == $sCPass) {
                    if (ereg('^[a-zA-Z0-9\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $sEmail)) {
                        if ($iGender == '1' xor $iGender == '0') {
                            $sVcode = escape($_POST['vcode']);
                            if (! isset($_SESSION['valdiation_code'])) {
                                // Here you can send him some verification code (by email or any another ways)
                                $sCode = uniqid(rand(), true);
                                $_SESSION['valdiation_code'] = md5($sCode);

                            } elseif (md5($sVcode) == $_SESSION['valdiation_code']) {
                                // Here you can add him to database
                                // mysql_query('INSERT INTO ....

                                // display step 3 (final step)
                                echo strtr(file_get_contents('templates/step3.html'), array());
                                exit;
                            } else {
                                $sErrors = 'Verification code is wrong';
                            }
                        } else {
                            $sErrors = 'Gender is wrong';
                        }
                    } else {
                        $sErrors = 'Email is wrong';
                    }
                } else {
                    $sErrors = 'Passwords are not the same';
                }
            } else {
                $sErrors = 'Address email is too long';
            }
        } else {
            $sErrors = 'Password is too long';
        }
    } else {
        $sErrors = 'Login is too long';
    }

    // display step 2
    $aParams = array(
        '{errors}' =&gt; $sErrors,
        '{login}' =&gt; $sLogin,
        '{pass}' =&gt; $sPass,
        '{cpass}' =&gt; $sCPass,
        '{gender}' =&gt; $iGender,
        '{email}' =&gt; $sEmail,
        '{vcode}' =&gt; $sCode
    );
    echo strtr(file_get_contents('templates/step2.html'), $aParams);
    exit;
}

// unset validation code if exists
unset($_SESSION['valdiation_code']);

// draw registration page
echo strtr(file_get_contents('templates/main_page.html'), array());

// extra useful function to make POST variables more safe
function escape($s) {
    //return mysql_real_escape_string(strip_tags($s)); // uncomment in when you will use connection with database
    return strip_tags($s);
}
</pre><p>Now, lets try to understand this. This script generally does EXACTLY the same what previous JS scripts did but it is launched on the server side to check everything once more. Continue reading to check how does it work.</p><p>So, please pay attention to all our checks, and &#8211; to added validation functional. When our form submitted, the next step will contain single field to accept some validation code. Of course, for our demo page you always can see that checking code. But, as some suggestion &#8211; I can offer you to enable email confirmation (as example). So, you have to add email sending to this code also. And, only after accepting that extra validation code (if this code was right) &#8211; only then allow member registration. Please read my comments carefully.</p><hr
/><h5 style="text-align: center;"><strong><a
title="Form Validation with Javascript and PHP - demo 228" href="http://www.script-tutorials.com/demos/228/index.php" target="_blank">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="Form Validation with Javascript and PHP - package" href="http://www.script-tutorials.com/demos/228/source.zip" target="_blank" rel="nofollow">download in archive</a></strong></h5><hr
/><h3>Conclusion</h3><p>So that is all for now. In the final version I also added some classes which make table better positioned (stable) so make sure you&#8217;ve checked it out. While creating your own form you can expand it anyhow relying on what I wrote or try to use your imagination to create something better. Hope you enjoyed it. Good luck and welcome back!</p><div
class="shr-publisher-1403"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/data-validation-html5/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/49.png" alt="Data Validation &#8211; How to Validate Forms using HTML5" /> <br
/> Data Validation &#8211; How to Validate Forms using HTML5</a></li><li> <a
href="http://www.script-tutorials.com/animated-photo-gallery-grid-with-javascript/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/54/thumb.png" alt="Animated Photo Gallery (grid) with javascript" /> <br
/> Animated Photo Gallery (grid) with javascript</a></li><li> <a
href="http://www.script-tutorials.com/cross-browser-effect-of-waves-using-javascript/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/81/thumb.png" alt="Creating Cross-browser Compatible Wave Effects Using Javascript" /> <br
/> Creating Cross-browser Compatible Wave Effects Using Javascript</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/form-validation-with-javascript-and-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>10 fresh jQuery plugins (january 2012)</title><link>http://www.script-tutorials.com/10-fresh-jquery-plugins-january-2012/</link> <comments>http://www.script-tutorials.com/10-fresh-jquery-plugins-january-2012/#comments</comments> <pubDate>Tue, 31 Jan 2012 16:49:15 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[resources]]></category> <category><![CDATA[january]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[plugins]]></category> <category><![CDATA[roundup]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1400</guid> <description><![CDATA[10 fresh jQuery plugins (january 2012) Our new hand-made collection of most impressive jQuery plugins. Here are different plugins for zooming, calendars, news ticker, and even full UI packs, nice file uploader and more. 1. jQuery UI Bootstrap A jQuery UI theme based on Twitter Bootstrap. 2. jqGrid This is pretty useful jQuery grid plugin. [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/10-fresh-jquery-plugins-for-working-with-forms-and-ui/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/101/thumb.png" alt="10 fresh jQuery plugins for working with forms and UI" /> 10 fresh jQuery plugins for working with forms and UI</a></li><li> <a
href="http://www.script-tutorials.com/10-fresh-jquery-plugins-december-2011/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/210/thumb.png" alt="10 fresh jQuery plugins (december 2011)" /> 10 fresh jQuery plugins (december 2011)</a></li><li> <a
href="http://www.script-tutorials.com/10-fresh-jquery-plugins-may-2011/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/73/thumb.png" alt="10 Oven Fresh jQuery Plugins" /> 10 Oven Fresh jQuery Plugins</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="Ten fresh jQuery plugins (january 2012)" src="http://www.script-tutorials.com/demos/227/thumb.png"></div><p><strong>10 fresh jQuery plugins (january 2012)</strong><br
/> <br
/>Our new hand-made collection of most impressive jQuery plugins. Here are different plugins for zooming, calendars, news ticker, and even full UI packs, nice file uploader and more.<br
/> <span
id="more-1400"></span></p><hr
/><h3><a
rel="nofollow" target="_blank" href="http://addyosmani.github.com/jquery-ui-bootstrap/">1. jQuery UI Bootstrap</a></h3><p>A jQuery UI theme based on Twitter Bootstrap.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img1.png" alt="jQuery UI Bootstrap" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.trirand.com/blog/">2. jqGrid</a></h3><p>This is pretty useful jQuery grid plugin. Online demo you can find <a
rel="nofollow" target="_blank" href="http://www.trirand.net/demophp.aspx">here</a>.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img2.png" alt="jqGrid" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.professorcloud.com/mainsite/cloud-zoom.htm">3. Cloud Zoom</a></h3><p>Cloud Zoom is a small jQuery image zoom plugin with smooth zoom movement, gallery mode, tint, soft focus and other zoom features.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img3.png" alt="Cloud Zoom" /></p><h3><a
rel="nofollow" target="_blank" href="http://reaktor.github.com/jquery-continuous-calendar/">4. jQuery continuous calendar</a></h3><p>Another one calendar plugin with next features: date dragging, continuous month flow, range shifting by dragging, range expand with shift + mouse click etc.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img4.png" alt="jQuery continuous calendar" /></p><h3><a
rel="nofollow" target="_blank" href="http://code.google.com/p/flot/">5. Flot</a></h3><p>Flot is a pure Javascript plotting library for jQuery. It produces graphical plots of arbitrary datasets on-the-fly client-side. Online demo you can find <a
rel="nofollow" target="_blank" href="http://people.iola.dk/olau/flot/examples/interacting.html">here</a>.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img5.png" alt="Flot" /></p><h3><a
rel="nofollow" target="_blank" href="http://arshaw.com/fullcalendar/">6. FullCalendar</a></h3><p>FullCalendar is a jQuery plugin that provides a full-sized, drag &#038; drop calendar like the one below. It uses AJAX to fetch events on-the-fly for each month and is easily configured to use your own feed format (an extension is provided for Google Calendar).<br
/> <img
src="http://www.script-tutorials.com/demos/227/img6.png" alt="FullCalendar" /></p><h3><a
rel="nofollow" target="_blank" href="http://www.jquerynewsticker.com/">7. jQuery News Ticker</a></h3><p>Taking inspiration from the BBC News website ticker, jQuery News Ticker brings a lightweight and easy to use news ticker to jQuery.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img7.png" alt="jQuery News Ticker" /></p><h3><a
rel="nofollow" target="_blank" href="http://blueimp.github.com/jQuery-File-Upload/">8. jQuery File Upload</a></h3><p>File Upload widget with multiple file selection, drag&#038;drop support, progress bar and preview images for jQuery. Supports cross-domain, chunked and resumable file uploads.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img8.png" alt="jQuery File Upload" /></p><h3><a
rel="nofollow" target="_blank" href="http://javascriptmvc.com/">9. JavaScriptMVC</a></h3><p>JavaScriptMVC is an open-source framework containing the best ideas in jQuery development. Online demo you can find <a
rel="nofollow" target="_blank" href="http://javascriptmvc.com/docs.html#!examples">here</a>.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img9.png" alt="JavaScriptMVC" /></p><h3><a
rel="nofollow" target="_blank" href="http://johnpolacek.github.com/scrollorama/">10. Scrollorama</a></h3><p>The jQuery plugin for doing cool scrolly stuff.<br
/> <img
src="http://www.script-tutorials.com/demos/227/img10.png" alt="Scrollorama" /></p><hr
/><h3>Conclusion</h3><p>Hope that our new collection of new jQuery plugins has been interested for you. Good luck!</p><div
class="shr-publisher-1400"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/10-fresh-jquery-plugins-for-working-with-forms-and-ui/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/101/thumb.png" alt="10 fresh jQuery plugins for working with forms and UI" /> <br
/> 10 fresh jQuery plugins for working with forms and UI</a></li><li> <a
href="http://www.script-tutorials.com/10-fresh-jquery-plugins-december-2011/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/210/thumb.png" alt="10 fresh jQuery plugins (december 2011)" /> <br
/> 10 fresh jQuery plugins (december 2011)</a></li><li> <a
href="http://www.script-tutorials.com/10-fresh-jquery-plugins-may-2011/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/73/thumb.png" alt="10 Oven Fresh jQuery Plugins" /> <br
/> 10 Oven Fresh jQuery Plugins</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/10-fresh-jquery-plugins-january-2012/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Powerful Chat System &#8211; Lesson 3</title><link>http://www.script-tutorials.com/powerful-chat-system-lesson-3/</link> <comments>http://www.script-tutorials.com/powerful-chat-system-lesson-3/#comments</comments> <pubDate>Mon, 30 Jan 2012 17:01:39 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[HTML/CSS]]></category> <category><![CDATA[HTML5]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[ajax chat]]></category> <category><![CDATA[chat]]></category> <category><![CDATA[chat system]]></category> <category><![CDATA[registration]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1396</guid> <description><![CDATA[Powerful Chat System &#8211; Lesson 3 Today we continue a series of articles on the creation of powerful chat system. Our third lesson will contain next elements: join form (with html5 validation). A long ago, I have already made similar validation. So you can refresh your memories if you like. Today I will publish updated [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/powerful-chat-system-lesson-2/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/221/thumb.png" alt="Powerful Chat System &#8211; Lesson 2" /> Powerful Chat System &#8211; Lesson 2</a></li><li> <a
href="http://www.script-tutorials.com/powerful-chat-system/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/218/thumb.png" alt="Powerful Chat System" /> Powerful Chat System</a></li><li> <a
href="http://www.script-tutorials.com/how-to-easily-make-ajax-style-php-chat-application/" rel="bookmark"> <img
src="/ssimages/no_image.gif" alt="How to Easily Make AJAX Style PHP Chat Application" /> How to Easily Make AJAX Style PHP Chat Application</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="Powerful Chat System" alt="Powerful Chat System" src="http://www.script-tutorials.com/demos/226/thumb.png"></div><p><strong>Powerful Chat System &#8211; Lesson 3</strong><br
/> <br
/>Today we continue a series of articles on the creation of powerful chat system. Our third lesson will contain next elements: join form (with html5 validation). A long ago, I have already made similar <a
target="_blank" href="http://www.script-tutorials.com/data-validation-html5/">validation</a>. So you can refresh your memories if you like.<br
/> <span
id="more-1396"></span></p><p>Today I will publish updated sources of our growing project (several files was modified, plus I expanded structure of database slightly). All project is well structured: system classes is in &#8216;classes&#8217; folder, stylesheets in &#8216;css&#8217; folder, template files in &#8216;templates&#8217; folder, and &#8211; new folder &#8216;js&#8217; for javascript files.</p><h5 style="text-align: center;"><strong><a
title="Powerful Chat System - demo 226" href="http://www.script-tutorials.com/demos/226/index.php" target="_blank">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="Powerful Chat System - package" href="http://www.script-tutorials.com/demos/226/source.zip" target="_blank">download in package</a></strong></h5><hr
/><p>Now &#8211; download the source files and lets start coding !</p><hr
/><h3>Step 1. SQL</h3><p>I have added new field into table of profiles where we will store its first names. So, please execute next SQL:</p><pre class="brush:sql">
ALTER TABLE `cs_profiles` ADD `first_name` varchar(255) NOT NULL default '' AFTER `name`;
</pre><h3>Step 2. HTML</h3><p>I have updated template with login form. As you can see &#8211; I have expanded this markup and added join form here:</p><h4>templates/logout_form.html</h4><pre class="brush:html">
&lt;div class=&quot;column&quot;&gt;
    &lt;h3&gt;Powerful Chat System Demonstration&lt;/h3&gt;
    &lt;p&gt;Our chat will contain next features: registration, main chat, profiles with avatars, ranking system, private messaging, custom rooms, moderation / administration and possible something else (in future).&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;column&quot;&gt;

    &lt;div class=&quot;tabs_container&quot;&gt;
        &lt;ul class=&quot;tabs&quot;&gt;
            &lt;li class=&quot;active&quot;&gt;&lt;h3&gt;Log In&lt;/h3&gt;&lt;/li&gt;
            &lt;li&gt;&lt;h3&gt;Join&lt;/h3&gt;&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;

    &lt;div class=&quot;nav_container&quot;&gt;
        &lt;form class=&quot;login_form&quot; action=&quot;index.php&quot; method=&quot;post&quot; id=&quot;1&quot;&gt;
            &lt;label&gt;Username:&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;username&quot;&gt;
            &lt;label&gt;Password:&lt;/label&gt;&lt;input type=&quot;password&quot; name=&quot;password&quot;&gt;
            &lt;input type=&quot;submit&quot; name=&quot;Login&quot; value=&quot;Login&quot;&gt;
        &lt;/form&gt;
        &lt;form class=&quot;join_form&quot; action=&quot;index.php&quot; method=&quot;post&quot; id=&quot;2&quot; style=&quot;display: none;&quot;&gt;

            &lt;label&gt;Full name:&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;username&quot; name=&quot;username&quot; placeholder=&quot;Your name&quot; maxlength=&quot;128&quot; title=&quot;Your name&quot; required&gt;

            &lt;label&gt;First name:&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;firstname&quot; name=&quot;firstname&quot; placeholder=&quot;Your first name&quot; maxlength=&quot;128&quot; title=&quot;Your first name&quot;&gt;

            &lt;label&gt;Last name:&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;lastname&quot; name=&quot;lastname&quot; placeholder=&quot;Your last name&quot; maxlength=&quot;128&quot; title=&quot;Your last name&quot;&gt;

            &lt;label&gt;Email:&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;email&quot; name=&quot;email&quot; placeholder=&quot;Your email&quot; maxlength=&quot;128&quot; title=&quot;Format: *@gmail.com&quot; pattern=&quot;.*@gmail\.com&quot; required&gt;

            &lt;label&gt;Password:&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;password&quot; name=&quot;password&quot; maxlength=&quot;128&quot; title=&quot;Password&quot; required&gt;

            &lt;label&gt;Repeat Password:&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;password&quot; name=&quot;password&quot; maxlength=&quot;128&quot; title=&quot;Repeat password&quot; required oninput=&quot;checkpass(this)&quot;&gt;

            &lt;input type=&quot;submit&quot; name=&quot;Join&quot; value=&quot;Join&quot;&gt;
        &lt;/form&gt;
    &lt;/div&gt;

&lt;/div&gt;

&lt;script&gt;
$(document).ready(function(){
    $('.tabs li h3').click(function () {
      $('.tabs li').removeClass('active');
      $(this).parent().addClass('active');

      $('.nav_container form').hide();
      var index = $('.tabs li h3').index(this);
      $('.nav_container form').eq(index).show();
      return false;
    });
});

function checkpass(input) {
    if (input.value != document.getElementById('password').value) {
        input.setCustomValidity('Password must match.');
    } else {
        input.setCustomValidity('');
    }
}
&lt;/script&gt;
</pre><p>Please pay attention to HTML structure of join form, it contain several new attributes for html5 validation: placeholder, required and pattern. This is pretty interesting.</p><h3>Step 3. CSS</h3><p>This file has updated too</p><h4>css/main.css</h4><pre class="brush:html">
/* page layout */
*{
    margin:0;
    padding:0;
}
body {
    background-color:#eee;
    color:#fff;
    font:14px/1.3 Arial,sans-serif;
}
header {
    background-color:#212121;
    box-shadow: 0 -1px 2px #111111;
    display:block;
    height:70px;
    position:relative;
    width:100%;
    z-index:100;
}
header h2{
    font-size:22px;
    font-weight:normal;
    left:50%;
    margin-left:-400px;
    padding:22px 0;
    position:absolute;
    width:540px;
}
header a.stuts,a.stuts:visited{
    border:none;
    text-decoration:none;
    color:#fcfcfc;
    font-size:14px;
    left:50%;
    line-height:31px;
    margin:23px 0 0 110px;
    position:absolute;
    top:0;
}
header .stuts span {
    font-size:22px;
    font-weight:bold;
    margin-left:5px;
}

/* main styles */
.container {
    background-color: #222;
    color: #bbb;
    margin: 20px auto;
    overflow: hidden;
    padding: 20px;
    position: relative;
    width: 800px;
}
.container h2 {
    color: #fff;
    margin-bottom: 10px;
}
.column {
    float: left;
    width: 48%;
}
.column:first-child {
    margin-right: 4%;
}
.column &gt; * {
    color: #ddd;
    margin-bottom: 10px;
}

/* tabs section */
.tabs_container {
    margin: 0;
}
.tabs {
    overflow: hidden;
}
.tabs li {
    float: left;
    list-style: none;
}
.tabs li h3:first-child {
    margin-left: 10px
}
.tabs li h3 {
    border: 1px solid #ddd;
    border-bottom-width: 0;
    display: block;
    margin: 0 2px 0 0;
    padding: 6px 10px 4px
}
.tabs li.active h3 {
    background-color: #555;
    border: 1px solid #ddd;
    border-bottom-width: 0;

    -moz-border-radius: 4px 4px 0 0;
    -ms-border-radius: 4px 4px 0 0;
    -o-border-radius: 4px 4px 0 0;
    -webkit-border-radius: 4px 4px 0 0;
    border-radius: 4px 4px 0 0;
}
.tabs li h3:hover {
    background-color: #666;
    cursor: pointer;
}
.tabs li.active h3:hover {
    background-color: #555;
    cursor: normal;
}
.nav_container form {
    background-color: #555;
    display: block;
    padding: 15px;
}
.column h3 {
    color: #fff;
}
.login_form input,.login_form label,
.join_form input,.join_form label {
    display: block;
    margin-bottom: 10px;
}
input[type=text], input[type=password], input[type=submit] {
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    -o-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
}
input[type=text], input[type=password] {
    font-size: 16px;
    height: 25px;
    margin-right: 10px;
    width: 200px;
}
input[type=submit]{
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    height: 35px;
    padding: 5px;
}

/* chat block */
.chat_messages {
    border: 1px solid #888;
    box-shadow: 0 0 5px #AAA;
    color: #000;
    padding: 10px;
}
.chat_messages h2 {
    color: #fff;
}
.chat_messages .message {
    background-color: #fff;
    margin: 5px;
    padding: 5px;

    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    -o-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
}
.chat_messages .message span {
    color: #444;
    font-size: 10px;
    margin-left: 10px;
}
.chat_submit_form {
    margin: 10px 0px;
}
.chat_submit_form div {
    float: left;
    width: 49%;
}
.chat_submit_form .error, .chat_submit_form .success, .chat_submit_form .protect {
    display: none;
}
.chat_submit_form .error {
    color: #f55;
}
.chat_submit_form .success {
    color: #5f5;
}
.chat_submit_form .protect {
    color: #55f;
}
</pre><h3>Step 4. PHP</h3><p>Now, lets review php sources. Our index.php file has updated. I have added here join processing functional. Before actual joining, we have to check if someone else was joined with same email (this field should be unique of course)</p><h4>index.php</h4><pre class="brush:php">
&lt;?php

// set error reporting level
if (version_compare(phpversion(), '5.3.0', '&gt;=') == 1)
  error_reporting(E_ALL &amp; ~E_NOTICE &amp; ~E_DEPRECATED);
else
  error_reporting(E_ALL &amp; ~E_NOTICE);

require_once('classes/Services_JSON.php');
require_once('classes/CMySQL.php'); // including service class to work with database
require_once('classes/CLogin.php'); // including service class to work with login processing

$sErrors = '';
// join processing
if (! isset($_SESSION['member_id']) &amp;&amp; $_POST['Join'] == 'Join') {
    $sUsername = $GLOBALS['MySQL']-&gt;escape($_POST['username']);
    $sFirstname = $GLOBALS['MySQL']-&gt;escape($_POST['firstname']);
    $sLastname = $GLOBALS['MySQL']-&gt;escape($_POST['lastname']);
    $sEmail = $GLOBALS['MySQL']-&gt;escape($_POST['email']);
    $sPassword = $GLOBALS['MySQL']-&gt;escape($_POST['password']);

    if ($sUsername &amp;&amp; $sEmail &amp;&amp; $sPassword) {
        // check if already exist
        $aProfile = $GLOBALS['MySQL']-&gt;getRow(&quot;SELECT * FROM `cs_profiles` WHERE `email`='{$sEmail}'&quot;);
        if ($aProfile['id'] &gt; 0) {
            $sErrors = '&lt;h2&gt;Another profile with same email already exist&lt;/h2&gt;';
        } else {
            // generate Salt and Cached password
            $sSalt = 'testing'; // TODO - we will add generation of salt in future
            $sPass = sha1(md5($sPassword) . $sSalt);

            // add new member into database
            $sSQL = &quot;
                INSERT INTO `cs_profiles` SET
                `name` = '{$sUsername}',
                `first_name` = '{$sFirstname}',
                `last_name` = '{$sLastname}',
                `email` = '{$sEmail}',
                `password` = '{$sPass}',
                `salt` = '{$sSalt}',
                `status` = 'active',
                `role` = '1',
                `date_reg` = NOW();
            &quot;;
            $GLOBALS['MySQL']-&gt;res($sSQL);

            // autologin
            $GLOBALS['CLogin']-&gt;performLogin($sUsername, $sPassword);
        }
    }
}

// login system init and generation code
$sLoginForm = $GLOBALS['CLogin']-&gt;getLoginBox();

$sChat = '&lt;h2&gt;You do not have rights to use chat&lt;/h2&gt;';
$sInput = '';
if ($_SESSION['member_id'] &amp;&amp; $_SESSION['member_status'] == 'active' &amp;&amp; $_SESSION['member_role']) {
    require_once('classes/CChat.php'); // including service class to work with chat

    // get last messages
    $sChat = $GLOBALS['MainChat']-&gt;getMessages();
    if ($_GET['action'] == 'get_last_messages') { // regular updating of messages in chat
        $oJson = new Services_JSON();
        header('Content-type: application/json');
        echo $oJson-&gt;encode(array('messages' =&gt; $sChat));
        exit;
    }

    // get input form
    $sInput = $GLOBALS['MainChat']-&gt;getInputForm();

    if ($_POST['message']) { // POST-ing of message
        $iRes = $GLOBALS['MainChat']-&gt;acceptMessage();

        $oJson = new Services_JSON();
        header('Content-type: application/json');
        echo $oJson-&gt;encode(array('result' =&gt; $iRes));
        exit;
    }
}

// draw common page
echo strtr(file_get_contents('templates/main_page.html'), array('{form}' =&gt; $sLoginForm . $sErrors, '{chat}' =&gt; $sChat, '{input}' =&gt; $sInput));
</pre><p>As you can see &#8211; I have added chat functionality today.</p><h4>classes/CLogin.php</h4><pre class="brush:php">
&lt;?php

class CLogin {

    // constructor
    function CLogin() {
        session_start();
    }

    // get login box function
    function getLoginBox() {
        if (isset($_GET['logout'])) { // logout processing
            if (isset($_SESSION['member_name']) &amp;&amp; isset($_SESSION['member_pass']))
                $this-&gt;performLogout();
        }

        if ($_POST &amp;&amp; $_POST['Login'] == 'Login' &amp;&amp; $_POST['username'] &amp;&amp; $_POST['password']) { // login processing
            if ($this-&gt;checkLogin($_POST['username'], $_POST['password'], false)) { // successful login
                $this-&gt;performLogin($_POST['username'], $_POST['password']);
                header( &quot;Location:{$_SERVER['REQUEST_URI']}&quot; );
                exit;
            } else { // wrong login
                return file_get_contents('templates/login_form.html') . '&lt;h2&gt;Username or Password is incorrect&lt;/h2&gt;';
            }
        } else { // in case if we already logged (on refresh page):
            if (isset($_SESSION['member_name']) &amp;&amp; $_SESSION['member_name'] &amp;&amp; $_SESSION['member_pass']) {
                $aReplaces = array(
                    '{name}' =&gt; $_SESSION['member_name'],
                    '{status}' =&gt; $_SESSION['member_status'],
                    '{role}' =&gt; $_SESSION['member_role'],
                );
                return strtr(file_get_contents('templates/logout_form.html'), $aReplaces);
            }

            // otherwise - draw login form
            return file_get_contents('templates/login_form.html');
        }
    }

    // perform login
    function performLogin($sName, $sPass) {
        $this-&gt;performLogout();

        // make variables safe
        $sName = $GLOBALS['MySQL']-&gt;escape($sName);

        $aProfile = $GLOBALS['MySQL']-&gt;getRow(&quot;SELECT * FROM `cs_profiles` WHERE `name`='{$sName}'&quot;);
        // $sPassEn = $aProfile['password'];
        $iPid = $aProfile['id'];
        $sSalt = $aProfile['salt'];
        $sStatus = $aProfile['status'];
        $sRole = $aProfile['role'];

        $sPass = sha1(md5($sPass) . $sSalt);

        $_SESSION['member_id'] = $iPid;
        $_SESSION['member_name'] = $sName;
        $_SESSION['member_pass'] = $sPass;
        $_SESSION['member_status'] = $sStatus;
        $_SESSION['member_role'] = $sRole;
    }

    // perform logout
    function performLogout() {
        unset($_SESSION['member_id']);
        unset($_SESSION['member_name']);
        unset($_SESSION['member_pass']);
        unset($_SESSION['member_status']);
        unset($_SESSION['member_role']);
    }

    // check login
    function checkLogin($sName, $sPass, $isHash = true) {
        // make variables safe
        $sName = $GLOBALS['MySQL']-&gt;escape($sName);
        $sPass = $GLOBALS['MySQL']-&gt;escape($sPass);

        $aProfile = $GLOBALS['MySQL']-&gt;getRow(&quot;SELECT * FROM `cs_profiles` WHERE `name`='{$sName}'&quot;);
        $sPassEn = $aProfile['password'];

        if ($sName &amp;&amp; $sPass &amp;&amp; $sPassEn) {
            if (! $isHash) {
                $sSalt = $aProfile['salt'];
                $sPass = sha1(md5($sPass) . $sSalt);
            }
            return ($sPass == $sPassEn);
        }
        return false;
    }
}

$GLOBALS['CLogin'] = new CLogin();
</pre><p>Minor changes were made in this file too. The rest of the functional was not changed. We will continue enhance our chat soon.</p><hr
/><h5 style="text-align: center;"><strong><a
title="Powerful Chat System - demo 226" href="http://www.script-tutorials.com/demos/226/index.php" target="_blank">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="Powerful Chat System - package" href="http://www.script-tutorials.com/demos/226/source.zip" target="_blank" rel="nofollow">download in archive</a></strong></h5><hr
/><h3>Conclusion</h3><p>I hope that our new series of articles of chat system creation is useful and interesting for you. If you want to share your ideas, or you noticed any weakness &#8211; don&#8217;t hesitate to contact us. Good luck and welcome back!</p><div
class="shr-publisher-1396"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/powerful-chat-system-lesson-2/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/221/thumb.png" alt="Powerful Chat System &#8211; Lesson 2" /> <br
/> Powerful Chat System &#8211; Lesson 2</a></li><li> <a
href="http://www.script-tutorials.com/powerful-chat-system/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/218/thumb.png" alt="Powerful Chat System" /> <br
/> Powerful Chat System</a></li><li> <a
href="http://www.script-tutorials.com/how-to-easily-make-ajax-style-php-chat-application/" rel="bookmark"> <img
src="/ssimages/no_image.gif" alt="How to Easily Make AJAX Style PHP Chat Application" /> <br
/> How to Easily Make AJAX Style PHP Chat Application</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/powerful-chat-system-lesson-3/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Invoicera offer results</title><link>http://www.script-tutorials.com/invoicera-offer-results/</link> <comments>http://www.script-tutorials.com/invoicera-offer-results/#comments</comments> <pubDate>Mon, 30 Jan 2012 05:36:36 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[resources]]></category> <category><![CDATA[offer]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1392</guid> <description><![CDATA[Invoicera offer results Several weeks ago, you took part in the Invoicera offer. The curtains are closed, so are the comments, and now is time to select the winners. We have selected the one person randomly using this generator. The winners are: Monique, Nicholas Barraco and Cedric. They win Classic Plan Subscription from Invoicera. For [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/invoicera-offer/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/invoicera/thumb.png" alt="Invoicera offer" /> Invoicera offer</a></li><li> <a
href="http://www.script-tutorials.com/4templates-com-offer/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/198/thumb.jpg" alt="4Templates.com offer" /> 4Templates.com offer</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="Height-based jQuery pagination to content" alt="Height-based jQuery pagination to content" src="http://www.script-tutorials.com/demos/invoicera/thumb.png"></div><p><strong>Invoicera offer results</strong><br
/> <br
/>Several weeks ago, you took part in the <a
href="http://www.script-tutorials.com/invoicera-offer/">Invoicera offer</a>. The curtains are closed, so are the comments, and now is time to select the winners.<br
/> <span
id="more-1392"></span></p><p>We have selected the one person randomly using this <a
rel="nofollow" href="http://textmechanic.com/Random-Line-Picker.html">generator</a>.</p><p>The winners are: <strong>Monique</strong>, <strong>Nicholas Barraco</strong> and <strong>Cedric</strong>. They win Classic Plan Subscription from <a
rel="nofollow" href="https://www.invoicera.com/" target="_blank">Invoicera</a>.</p><p><img
src="http://www.script-tutorials.com/demos/invoicera/image.jpg" /></p><p>For those that did not win, I am wishing best of luck in the future!</p><div
class="shr-publisher-1392"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/invoicera-offer/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/invoicera/thumb.png" alt="Invoicera offer" /> <br
/> Invoicera offer</a></li><li> <a
href="http://www.script-tutorials.com/4templates-com-offer/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/198/thumb.jpg" alt="4Templates.com offer" /> <br
/> 4Templates.com offer</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/invoicera-offer-results/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>CSS3 Image Hover Effects</title><link>http://www.script-tutorials.com/css3-image-hover-effects/</link> <comments>http://www.script-tutorials.com/css3-image-hover-effects/#comments</comments> <pubDate>Wed, 25 Jan 2012 16:59:22 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[HTML/CSS]]></category> <category><![CDATA[css3]]></category> <category><![CDATA[effects]]></category> <category><![CDATA[image hover]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1386</guid> <description><![CDATA[CSS3 Image Hover Effects Today I will tell you how to create different CSS3 image hover effects. I hope that you still remember our one old tutorial. We used javascript there. Today I will try to make something similar with using CSS3. In the result gallery page we will have 9 images, each of them [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/how-to-create-a-pure-css3-slideshow/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/204/thumb.png" alt="How to Create a Pure CSS3 Slideshow" /> How to Create a Pure CSS3 Slideshow</a></li><li> <a
href="http://www.script-tutorials.com/how-to-do-pure-css3-photo-gallery/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/171/thumb.png" alt="How to Create a Pure CSS3 Animated Photo Gallery" /> How to Create a Pure CSS3 Animated Photo Gallery</a></li><li> <a
href="http://www.script-tutorials.com/how-to-create-a-pure-css3-animated-buttons/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/184/thumb.png" alt="Creating Fantastic Animated Buttons using CSS3" /> Creating Fantastic Animated Buttons using CSS3</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="CSS3 Image Hover Effects" alt="CSS3 Image Hover Effects" src="http://www.script-tutorials.com/demos/225/thumb.png"></div><p><strong>CSS3 Image Hover Effects</strong><br
/> <br
/>Today I will tell you how to create different CSS3 image hover effects. I hope that you still remember our <a
target="_blank" href="http://www.script-tutorials.com/animated-photo-gallery-grid-with-javascript/">one old tutorial</a>. We used javascript there. Today I will try to make something similar with using CSS3. In the result gallery page we will have 9 images, each of them have own hover effect.<br
/> <span
id="more-1386"></span></p><h5 style="text-align: center;"><strong><a
title="CSS3 Image Hover Effects - online demo" href="http://www.script-tutorials.com/demos/225/index.html" target="_blank">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="CSS3 Image Hover Effects - package" href="http://www.script-tutorials.com/demos/225/source.zip" target="_blank">download result</a></strong></h5><hr
/><p>Ok, download the example files and lets start !</p><hr
/><h3>Step 1. HTML</h3><p>First, lets prepare the main HTML markup for our demo gallery. As you can see &#8211; result structure is quite easy. Here are set of DIV objects. Each of them contain one image and some virtual mask (DIV). Last one element will contain two masks.</p><h4>index.html</h4><pre class="brush:html">
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot; &gt;
    &lt;head&gt;
        &lt;meta charset=&quot;utf-8&quot; /&gt;
        &lt;title&gt;CSS3 Image Hover Effects | Script Tutorials&lt;/title&gt;
        &lt;link href=&quot;css/layout.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
        &lt;link href=&quot;css/gall.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;header&gt;
            &lt;h2&gt;CSS3 Image Hover Effects&lt;/h2&gt;
            &lt;a href=&quot;http://www.script-tutorials.com/css3-image-hover-effects/&quot; class=&quot;stuts&quot;&gt;Back to original tutorial on &lt;span&gt;Script Tutorials&lt;/span&gt;&lt;/a&gt;
        &lt;/header&gt;

        &lt;!-- panel with buttons --&gt;
        &lt;div class=&quot;photos&quot;&gt;
            &lt;div&gt;
                &lt;img src=&quot;images/pic1.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;img src=&quot;images/pic2.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;img src=&quot;images/pic3.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;img src=&quot;images/pic4.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;img src=&quot;images/pic5.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;img src=&quot;images/pic6.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;img src=&quot;images/pic7.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;img src=&quot;images/pic8.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;pair&quot;&gt;
                &lt;img src=&quot;images/pic9.jpg&quot; /&gt;
                &lt;div&gt;&lt;/div&gt;
                &lt;div&gt;&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre><h3>Step 2. CSS</h3><p>I omit styles of layout.css. Here are nothing interesting. The most interesting &#8211; next one file (where I have prepared all necessary styles of our gallery):</p><h4>css/gall.css</h4><pre class="brush:css">
.photos {
    width: 945px;
    height: 400px;
    margin: 100px auto;
    position:relative;
}
.photos &gt; div {
    background-color: rgba(128, 128, 128, 0.5);
    border: 2px solid #444;
    float: left;
    height: 100px;
    margin: 5px;
    overflow: hidden;
    position: relative;
    width: 300px;
    z-index: 1;

    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    -ms-border-radius: 10px;
    -o-border-radius: 10px;
    border-radius: 10px;

    -webkit-transform:scale(1.0);
    -moz-transform:scale(1.0);
    -ms-transform:scale(1.0);
    -o-transform:scale(1.0);
    transform:scale(1.0);

    -webkit-transition-duration: 0.5s;
    -moz-transition-duration: 0.5s;
    -ms-transition-duration: 0.5s;
    -o-transition-duration: 0.5s;
    transition-duration: 0.5s;
}
.photos &gt; div img{
    width: 100%;
}
.photos &gt; div:hover{
    z-index: 10;

    -webkit-transform:scale(2.0);
    -moz-transform:scale(2.0);
    -ms-transform:scale(2.0);
    -o-transform:scale(2.0);
    transform:scale(2.0);
}
.photos &gt; div div {
    background: url(../images/hover.gif) repeat scroll 0 0 transparent;
    cursor: pointer;
    height: 100%;
    left: 0;
    opacity: 0.5;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 15;

    -webkit-transition-duration: 0.5s;
    -moz-transition-duration: 0.5s;
    -ms-transition-duration: 0.5s;
    -o-transition-duration: 0.5s;
    transition-duration: 0.5s;
}
.photos &gt; div:nth-child(1):hover div {
    height: 0%;
}

.photos &gt; div:nth-child(2):hover div {
    height: 0%;
    margin-top: 100px;
}
.photos &gt; div:nth-child(3):hover div {
    width: 0%;
}
.photos &gt; div:nth-child(4):hover div {
    margin-left: 300px;
    width: 0%;
}
.photos &gt; div:nth-child(5):hover div {
    height: 0%;
    margin-left: 150px;
    margin-top: 50px;
    width: 0%;
}
.photos &gt; div:nth-child(6):hover div {
    margin-left: 150px;
    width: 0%;
}
.photos &gt; div:nth-child(7):hover div {
    height: 0%;
    margin-left: 150px;
    margin-top: 50px;
    width: 0%;

    -webkit-transform: rotateX(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -o-transform: rotate(-360deg);
    transform: rotate(-360deg);
}
.photos &gt; div:nth-child(8):hover div {
    height: 0%;
    margin-left: 150px;
    margin-top: 50px;
    width: 0%;

    -webkit-transform: rotateZ(600deg);
    -moz-transform: rotateZ(600deg);
    -ms-transform: rotateZ(600deg);
    -o-transform: rotateZ(600deg);
    transform: rotateZ(600deg);
}
.photos &gt; div.pair div {
    width: 50%;
}
.photos &gt; div.pair div:nth-child(odd) {
    margin-left: 150px;
}
.photos &gt; div.pair:hover div {
    width: 0%;
}
.photos &gt; div.pair:hover div:nth-child(odd) {
    margin-left: 300px;
}
</pre><hr
/><h5 style="text-align: center;"><strong><a
title="CSS3 Image Hover Effects - demo 225" href="http://www.script-tutorials.com/demos/225/index.html" target="_blank" rel="nofollow">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="CSS3 Image Hover Effects - package" href="http://www.script-tutorials.com/demos/225/source.zip" target="_blank" rel="nofollow">download result</a></strong></h5><hr
/><h3>Conclusion</h3><p>Today we have nine great onhover image effects. Welcome back to read our new tutorials!</p><div
class="shr-publisher-1386"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/how-to-create-a-pure-css3-slideshow/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/204/thumb.png" alt="How to Create a Pure CSS3 Slideshow" /> <br
/> How to Create a Pure CSS3 Slideshow</a></li><li> <a
href="http://www.script-tutorials.com/how-to-do-pure-css3-photo-gallery/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/171/thumb.png" alt="How to Create a Pure CSS3 Animated Photo Gallery" /> <br
/> How to Create a Pure CSS3 Animated Photo Gallery</a></li><li> <a
href="http://www.script-tutorials.com/how-to-create-a-pure-css3-animated-buttons/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/184/thumb.png" alt="Creating Fantastic Animated Buttons using CSS3" /> <br
/> Creating Fantastic Animated Buttons using CSS3</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/css3-image-hover-effects/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>HTML5 Canvas Slideshow</title><link>http://www.script-tutorials.com/html5-canvas-slideshow/</link> <comments>http://www.script-tutorials.com/html5-canvas-slideshow/#comments</comments> <pubDate>Tue, 24 Jan 2012 15:40:20 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[HTML5]]></category> <category><![CDATA[canvas]]></category> <category><![CDATA[html5 slideshow]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1383</guid> <description><![CDATA[HTML5 Canvas Slideshow In this tutorial we are making a HTML5 Slideshow (canvas) with own animated transitioning effect. The main idea &#8211; drawing images with higher contrast in the ends of transitions. Here are our demo and downloadable package: Live Demo download in package Ok, download the source files and lets start coding ! Step [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/html5-canvas-image-effects-app-adding-blur/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/127/thumb.png" alt="HTML5 Canvas Image Effects App &#8211; Adding Blur" /> HTML5 Canvas Image Effects App &#8211; Adding Blur</a></li><li> <a
href="http://www.script-tutorials.com/html5-canvas-image-zoomer/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/167/thumb.png" alt="Creating an Image Zoomer in HTML5 Canvas" /> Creating an Image Zoomer in HTML5 Canvas</a></li><li> <a
href="http://www.script-tutorials.com/html5-canvas-image-effects-app/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/118/thumb.png" alt="Creating an Unbelievable HTML5 Canvas App for Online Image Enhancements" /> Creating an Unbelievable HTML5 Canvas App for Online Image Enhancements</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="HTML5 Canvas Slideshow" alt="HTML5 Canvas Slideshow" src="http://www.script-tutorials.com/demos/224/thumb.png"></div><p><strong>HTML5 Canvas Slideshow</strong><br
/> <br
/>In this tutorial we are making a HTML5 Slideshow (canvas) with own animated transitioning effect. The main idea &#8211; drawing images with higher contrast in the ends of transitions.<br
/> <span
id="more-1383"></span><br
/></p><p>Here are our demo and downloadable package:</p><h5 style="text-align: center;"><strong><a
title="HTML5 Canvas Slideshow - demo 224" href="http://www.script-tutorials.com/demos/224/index.html" target="_blank">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="HTML5 Canvas Slideshow - package" href="http://www.script-tutorials.com/demos/224/source.zip" target="_blank">download in package</a></strong></h5><hr
/><p>Ok, download the source files and lets start coding !</p><hr
/><h3>Step 1. HTML</h3><p>This is markup of our result slideshow page. Here it is.</p><h4>index.html</h4><pre class="brush:html">
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot; &gt;
    &lt;head&gt;
        &lt;meta charset=&quot;utf-8&quot; /&gt;
        &lt;title&gt;HTML5 Canvas Slideshow | Script Tutorials&lt;/title&gt;
        &lt;link href=&quot;css/main.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
        &lt;script src=&quot;http://code.jquery.com/jquery-latest.min.js&quot;&gt;&lt;/script&gt;
        &lt;script src=&quot;js/pixastic.custom.js&quot;&gt;&lt;/script&gt;
        &lt;script src=&quot;js/script.js&quot;&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;header&gt;
            &lt;h2&gt;HTML5 Canvas Slideshow&lt;/h2&gt;
            &lt;a href=&quot;http://www.script-tutorials.com/html5-canvas-slideshow/&quot; class=&quot;stuts&quot;&gt;Back to original tutorial on &lt;span&gt;Script Tutorials&lt;/span&gt;&lt;/a&gt;
        &lt;/header&gt;
        &lt;div class=&quot;container&quot;&gt;
            &lt;div class=&quot;slides&quot;&gt;
                &lt;img src=&quot;images/pic1.jpg&quot; /&gt;
                &lt;img src=&quot;images/pic2.jpg&quot; /&gt;
                &lt;img src=&quot;images/pic3.jpg&quot; /&gt;
                &lt;img src=&quot;images/pic4.jpg&quot; /&gt;
                &lt;img src=&quot;images/pic5.jpg&quot; /&gt;
                &lt;img src=&quot;images/pic6.jpg&quot; /&gt;
                &lt;img src=&quot;images/pic7.jpg&quot; /&gt;
            &lt;/div&gt;
            &lt;canvas id=&quot;slideshow&quot; width=&quot;900&quot; height=&quot;300&quot;&gt;&lt;/canvas&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre><h3>Step 2. CSS</h3><p>Here are all stylesheets</p><h4>css/main.css</h4><pre class="brush:css">
/* page layout styles */
*{
    margin:0;
    padding:0;
}
body {
    background-color:#eee;
    color:#fff;
    font:14px/1.3 Arial,sans-serif;
}
header {
    background-color:#212121;
    box-shadow: 0 -1px 2px #111111;
    display:block;
    height:70px;
    position:relative;
    width:100%;
    z-index:100;
}
header h2{
    font-size:22px;
    font-weight:normal;
    left:50%;
    margin-left:-400px;
    padding:22px 0;
    position:absolute;
    width:540px;
}
header a.stuts,a.stuts:visited{
    border:none;
    text-decoration:none;
    color:#fcfcfc;
    font-size:14px;
    left:50%;
    line-height:31px;
    margin:23px 0 0 110px;
    position:absolute;
    top:0;
}
header .stuts span {
    font-size:22px;
    font-weight:bold;
    margin-left:5px;
}
.container {
    color: #000;
    margin: 20px auto;
    position: relative;
    width: 900px;
}
#slideshow {
    border:1px #000 solid;
    box-shadow:4px 6px 6px #444444;
    display:block;
    margin:0 auto;
    height:300px;
    width:900px;
}
.container .slides {
    display:none;
}
</pre><h3>Step 3. JS</h3><h4>js/pixastic.custom.js</h4><p>Pixastic &#8211; JavaScript Image Processing Library. I have used it to change brightness and contrast of our canvas. You can download this library <a
rel="nofollow" href="http://www.pixastic.com/lib/download/">here</a>. Or, you can find this library in our package too.</p><h4>js/script.js</h4><pre class="brush:js">
var canvas, ctx;
var aImages = [];
var iCurSlide = 0;
var iCnt = 0;
var iSmTimer = 0;
var iContr = 0;
var iEfIter = 50;

$(function(){
    // creating canvas objects
    canvas = document.getElementById('slideshow');
    ctx = canvas.getContext('2d');

    // collect all images
    $('.slides').children().each(function(i){
        var oImg = new Image();
        oImg.src = this.src;
        aImages.push(oImg);
    });

    // draw first image
    ctx.drawImage(aImages[iCurSlide], 0, 0);

    var iTimer = setInterval(changeSlideTimer, 5000); // set inner timer
});

function changeSlideTimer() {
    iCurSlide++;
    if (iCurSlide == $(aImages).length) {
        iCurSlide = 0;
    }

    clearInterval(iSmTimer);
    iSmTimer = setInterval(drawSwEffect, 40); // extra one timer
}

// draw switching effect
function drawSwEffect() {
    iCnt++;

    if (iCnt &lt;= iEfIter / 2) {
        iContr += 0.004;

        // change brightness and contrast
        Pixastic.process(canvas, 'brightness',
            {
                'brightness': 2,
                'contrast': 0.0 + iContr,
                'leaveDOM': true
            },
            function(img) {
                ctx.drawImage(img, 0, 0);
            }
        );
    }

    if (iCnt &gt; iEfIter / 2) {
        // change brightness
        Pixastic.process(canvas, 'brightness',
            {
                'brightness': -2,
                'contrast': 0,
                'leaveDOM': true
            },
            function(img) {
                ctx.drawImage(img, 0, 0);
            }
        );
    }

    if (iCnt == iEfIter / 2) { // switch actual image
        iContr = 0;
        ctx.drawImage(aImages[iCurSlide], 0, 0);

        Pixastic.process(canvas, 'brightness',
            {
                'brightness': iEfIter,
                'contrast': 0,
                'leaveDOM': true
            },
            function(img) {
                ctx.drawImage(img, 0, 0);
            }
        );
    } else if (iCnt == iEfIter) { // end of cycle, clear extra sub timer
        clearInterval(iSmTimer);
        iCnt = 0;
        iContr = 0;
    }
}
</pre><p>As you can see &#8211; main functionality is easy. I have defined main timer (which will change images), and one inner time, which will use to change brightness and contrast of our canvas.</p><hr
/><h5 style="text-align: center;"><strong><a
title="HTML5 Canvas Slideshow - demo 224" href="http://www.script-tutorials.com/demos/224/index.html" target="_blank" rel="nofollow">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="HTML5 Canvas Slideshow - package" href="http://www.script-tutorials.com/demos/224/source.zip" target="_blank" rel="nofollow">download in package</a></strong></h5><hr
/><h3>Conclusion</h3><p>Hope that today&#8217;s html5 slideshow lesson was interesting for you as always. We have made another one nice html5 example. I will be glad to see your thanks and comments. Good luck!</p><div
class="shr-publisher-1383"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/html5-canvas-image-effects-app-adding-blur/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/127/thumb.png" alt="HTML5 Canvas Image Effects App &#8211; Adding Blur" /> <br
/> HTML5 Canvas Image Effects App &#8211; Adding Blur</a></li><li> <a
href="http://www.script-tutorials.com/html5-canvas-image-zoomer/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/167/thumb.png" alt="Creating an Image Zoomer in HTML5 Canvas" /> <br
/> Creating an Image Zoomer in HTML5 Canvas</a></li><li> <a
href="http://www.script-tutorials.com/html5-canvas-image-effects-app/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/118/thumb.png" alt="Creating an Unbelievable HTML5 Canvas App for Online Image Enhancements" /> <br
/> Creating an Unbelievable HTML5 Canvas App for Online Image Enhancements</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/html5-canvas-slideshow/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>HTML5 Game Development &#8211; Lesson 7</title><link>http://www.script-tutorials.com/html5-game-development-lesson-7/</link> <comments>http://www.script-tutorials.com/html5-game-development-lesson-7/#comments</comments> <pubDate>Mon, 23 Jan 2012 18:24:06 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[HTML/CSS]]></category> <category><![CDATA[HTML5]]></category> <category><![CDATA[collisions]]></category> <category><![CDATA[game development]]></category> <category><![CDATA[html5 games]]></category> <category><![CDATA[HTML5 local storage]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1380</guid> <description><![CDATA[HTML5 Game Development &#8211; Lesson 7 Today we will create our first complete game &#8211; Arkanoid. In this lesson I will show you how to detect basic collisions and work with HTML5 local storage. You can operate with pad using mouse and keyboard (left/right buttons). We will store in local storage elapsed time of previous [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/html5-game-development-lesson-6/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/214/thumb.png" alt="HTML5 Game Development &#8211; Lesson 6" /> HTML5 Game Development &#8211; Lesson 6</a></li><li> <a
href="http://www.script-tutorials.com/html5-game-development-lesson-5/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/205/thumb.png" alt="HTML5 Game Development &#8211; Lesson 5" /> HTML5 Game Development &#8211; Lesson 5</a></li><li> <a
href="http://www.script-tutorials.com/html5-game-development-navigating-your-spaceship-lesson-3/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/166/thumb.png" alt="HTML5 Game Development &#8211; Navigating Your Spaceship- Lesson 3" /> HTML5 Game Development &#8211; Navigating Your Spaceship- Lesson 3</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="HTML5 Game Development - Lesson 7" alt="HTML5 Game Development - Lesson 7" src="http://www.script-tutorials.com/demos/223/thumb.png"></div><p><strong>HTML5 Game Development &#8211; Lesson 7</strong><br
/> <br
/>Today we will create our first complete game &#8211; Arkanoid. In this lesson I will show you how to detect basic collisions and work with HTML5 local storage. You can operate with pad using mouse and keyboard (left/right buttons). We will store in local storage elapsed time of previous game and amount of broken bricks (points).<br
/> <br
/>Here you can read our previous lesson: <a
href="http://www.script-tutorials.com/html5-game-development-lesson-6/">Developing Your First HTML5 Game – Lesson 6</a>.<br
/> <span
id="more-1380"></span><br
/></p><p>Here are our demo and downloadable package:</p><h5 style="text-align: center;"><strong><a
title="HTML5 Game Development - Lesson 7 - live demo" href="http://www.script-tutorials.com/demos/223/index.html" target="_blank">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="HTML5 Game Development - Lesson 7 - package" href="http://www.script-tutorials.com/demos/223/source.zip" target="_blank">download in package</a></strong></h5><hr
/><p>Ok, download the example files and lets start coding !</p><hr
/><h3>Step 1. HTML</h3><p>Here is source code of our seventh lesson</p><h4>index.html</h4><pre class="brush:html">
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot; &gt;
    &lt;head&gt;
        &lt;meta charset=&quot;utf-8&quot; /&gt;
        &lt;title&gt;HTML5 Game Development - Lesson 7 | Script Tutorials&lt;/title&gt;
        &lt;link href=&quot;css/main.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
        &lt;script src=&quot;js/jquery-1.5.2.min.js&quot;&gt;&lt;/script&gt;
        &lt;script src=&quot;js/script.js&quot;&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;header&gt;
            &lt;h2&gt;HTML5 Game Development - Lesson 7&lt;/h2&gt;
            &lt;a href=&quot;http://www.script-tutorials.com/html5-game-development-lesson-7/&quot; class=&quot;stuts&quot;&gt;Back to original tutorial on &lt;span&gt;Script Tutorials&lt;/span&gt;&lt;/a&gt;
        &lt;/header&gt;

        &lt;div class=&quot;container&quot;&gt;
            &lt;canvas id=&quot;scene&quot; width=&quot;800&quot; height=&quot;600&quot;&gt;&lt;/canvas&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre><h3>Step 2. CSS</h3><p>Here are used CSS styles.</p><h4>css/main.css</h4><pre class="brush:css">
/* page layout styles */
*{
    margin:0;
    padding:0;
}
body {
    background-color:#eee;
    color:#fff;
    font:14px/1.3 Arial,sans-serif;
}
header {
    background-color:#212121;
    box-shadow: 0 -1px 2px #111111;
    display:block;
    height:70px;
    position:relative;
    width:100%;
    z-index:100;
}
header h2{
    font-size:22px;
    font-weight:normal;
    left:50%;
    margin-left:-400px;
    padding:22px 0;
    position:absolute;
    width:540px;
}
header a.stuts,a.stuts:visited{
    border:none;
    text-decoration:none;
    color:#fcfcfc;
    font-size:14px;
    left:50%;
    line-height:31px;
    margin:23px 0 0 110px;
    position:absolute;
    top:0;
}
header .stuts span {
    font-size:22px;
    font-weight:bold;
    margin-left:5px;
}
.container {
    margin: 20px auto;
    overflow: hidden;
    position: relative;
    width: 800px;
}
</pre><h3>Step 3. JS</h3><h4>js/jquery-1.5.2.min.js</h4><p>We use jQuery for our lesson. Available in package. Next file most important (here are all our html5 functional):</p><h4>js/script.js</h4><pre class="brush:js">
// inner variables
var canvas, ctx;

var iStart = 0;
var bRightBut = false;
var bLeftBut = false;
var oBall, oPadd, oBricks;
var aSounds = [];
var iPoints = 0;
var iGameTimer;
var iElapsed = iMin = iSec = 0;
var sLastTime, sLastPoints;

// objects :
function Ball(x, y, dx, dy, r) {
    this.x = x;
    this.y = y;
    this.dx = dx;
    this.dy = dy;
    this.r = r;
}
function Padd(x, w, h, img) {
    this.x = x;
    this.w = w;
    this.h = h;
    this.img = img;
}
function Bricks(w, h, r, c, p) {
    this.w = w;
    this.h = h;
    this.r = r; // rows
    this.c = c; // cols
    this.p = p; // padd
    this.objs;
    this.colors = ['#9d9d9d', '#f80207', '#feff01', '#0072ff', '#fc01fc', '#03fe03']; // colors for rows
}

// -------------------------------------------------------------
// draw functions :

function clear() { // clear canvas function
    ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);

    // fill background
    ctx.fillStyle = '#111';
    ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
}

function drawScene() { // main drawScene function
    clear(); // clear canvas

    // draw Ball (circle)
    ctx.fillStyle = '#f66';
    ctx.beginPath();
    ctx.arc(oBall.x, oBall.y, oBall.r, 0, Math.PI * 2, true);
    ctx.closePath();
    ctx.fill();

    if (bRightBut)
        oPadd.x += 5;
    else if (bLeftBut)
        oPadd.x -= 5;

    // draw Padd (rectangle)
    ctx.drawImage(oPadd.img, oPadd.x, ctx.canvas.height - oPadd.h);

    // draw bricks (from array of its objects)
    for (i=0; i &lt; oBricks.r; i++) {
        ctx.fillStyle = oBricks.colors[i];
        for (j=0; j &lt; oBricks.c; j++) {
            if (oBricks.objs[i][j] == 1) {
                ctx.beginPath();
                ctx.rect((j * (oBricks.w + oBricks.p)) + oBricks.p, (i * (oBricks.h + oBricks.p)) + oBricks.p, oBricks.w, oBricks.h);
                ctx.closePath();
                ctx.fill();
            }
        }
    }

    // collision detection
    iRowH = oBricks.h + oBricks.p;
    iRow = Math.floor(oBall.y / iRowH);
    iCol = Math.floor(oBall.x / (oBricks.w + oBricks.p));

    // mark brick as broken (empty) and reverse brick
    if (oBall.y &lt; oBricks.r * iRowH &amp;&amp; iRow &gt;= 0 &amp;&amp; iCol &gt;= 0 &amp;&amp; oBricks.objs[iRow][iCol] == 1) {
        oBricks.objs[iRow][iCol] = 0;
        oBall.dy = -oBall.dy;
        iPoints++;

        aSounds[0].play(); // play sound
    }

    // reverse X position of ball
    if (oBall.x + oBall.dx + oBall.r &gt; ctx.canvas.width || oBall.x + oBall.dx - oBall.r &lt; 0) {
        oBall.dx = -oBall.dx;
    }

    if (oBall.y + oBall.dy - oBall.r &lt; 0) {
        oBall.dy = -oBall.dy;
    } else if (oBall.y + oBall.dy + oBall.r &gt; ctx.canvas.height - oPadd.h) {
        if (oBall.x &gt; oPadd.x &amp;&amp; oBall.x &lt; oPadd.x + oPadd.w) {
            oBall.dx = 10 * ((oBall.x-(oPadd.x+oPadd.w/2))/oPadd.w);
            oBall.dy = -oBall.dy;

            aSounds[2].play(); // play sound
        }
        else if (oBall.y + oBall.dy + oBall.r &gt; ctx.canvas.height) {
            clearInterval(iStart);
            clearInterval(iGameTimer);

            // HTML5 Local storage - save values
            localStorage.setItem('last-time', iMin + ':' + iSec);
            localStorage.setItem('last-points', iPoints);

            aSounds[1].play(); // play sound
        }
    }

    oBall.x += oBall.dx;
    oBall.y += oBall.dy;

    ctx.font = '16px Verdana';
    ctx.fillStyle = '#fff';
    iMin = Math.floor(iElapsed / 60);
    iSec = iElapsed % 60;
    if (iMin &lt; 10) iMin = &quot;0&quot; + iMin;
    if (iSec &lt; 10) iSec = &quot;0&quot; + iSec;
    ctx.fillText('Time: ' + iMin + ':' + iSec, 600, 520);
    ctx.fillText('Points: ' + iPoints, 600, 550);

    if (sLastTime != null &amp;&amp; sLastPoints != null) {
        ctx.fillText('Last Time: ' + sLastTime, 600, 460);
        ctx.fillText('Last Points: ' + sLastPoints, 600, 490);
    }
}

// initialization
$(function(){
    canvas = document.getElementById('scene');
    ctx = canvas.getContext('2d');

    var width = canvas.width;
    var height = canvas.height;

    var padImg = new Image();
    padImg.src = 'images/padd.png';
    padImg.onload = function() {};

    oBall = new Ball(width / 2, 550, 0.5, -5, 10); // new ball object
    oPadd = new Padd(width / 2, 120, 20, padImg); // new padd object
    oBricks = new Bricks((width / <img src='http://www.script-tutorials.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> - 1, 20, 6, 8, 2); // new bricks object

    oBricks.objs = new Array(oBricks.r); // fill-in bricks
    for (i=0; i &lt; oBricks.r; i++) {
        oBricks.objs[i] = new Array(oBricks.c);
        for (j=0; j &lt; oBricks.c; j++) {
            oBricks.objs[i][j] = 1;
        }
    }

    aSounds[0] = new Audio('media/snd1.wav');
    aSounds[0].volume = 0.9;
    aSounds[1] = new Audio('media/snd2.wav');
    aSounds[1].volume = 0.9;
    aSounds[2] = new Audio('media/snd3.wav');
    aSounds[2].volume = 0.9;

    iStart = setInterval(drawScene, 10); // loop drawScene
    iGameTimer = setInterval(countTimer, 1000); // inner game timer

    // HTML5 Local storage - get values
    sLastTime = localStorage.getItem('last-time');
    sLastPoints = localStorage.getItem('last-points');

    $(window).keydown(function(event){ // keyboard-down alerts
        switch (event.keyCode) {
            case 37: // 'Left' key
                bLeftBut = true;
                break;
            case 39: // 'Right' key
                bRightBut = true;
                break;
        }
    });
    $(window).keyup(function(event){ // keyboard-up alerts
        switch (event.keyCode) {
            case 37: // 'Left' key
                bLeftBut = false;
                break;
            case 39: // 'Right' key
                bRightBut = false;
                break;
        }
    });

    var iCanvX1 = $(canvas).offset().left;
    var iCanvX2 = iCanvX1 + width;
    $('#scene').mousemove(function(e) { // binding mousemove event
        if (e.pageX &gt; iCanvX1 &amp;&amp; e.pageX &lt; iCanvX2) {
            oPadd.x = Math.max(e.pageX - iCanvX1 - (oPadd.w/2), 0);
            oPadd.x = Math.min(ctx.canvas.width - oPadd.w, oPadd.x);
        }
    });
});

function countTimer() {
    iElapsed++;
}
</pre><p>I added my comments anywhere, hope that all code is pretty understandable. Please pay attention to &#8216;localStorage&#8217; object to understand how to work with HTML5 Local storage (I use &#8216;setItem&#8217; method to store something and &#8216;getItem&#8217; to read this from local storage). Also, it can be also interesting to understand how to calculate collisions between the ball and bricks.</p><hr
/><h5 style="text-align: center;"><strong><a
title="HTML5 Game Development - Lesson 7 - live demo" href="http://www.script-tutorials.com/demos/223/index.html" target="_blank" rel="nofollow">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="HTML5 Game Development - Lesson 7 - package" href="http://www.script-tutorials.com/demos/223/source.zip" target="_blank" rel="nofollow">download in package</a></strong></h5><hr
/><h3>Conclusion</h3><p>Today, we made our first arkanoid game. Most functionality are already here. We have implemented our first knowledge about collisions and HTML5 local storage too. I will be glad to see your thanks and comments. Good luck!</p><div
class="shr-publisher-1380"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/html5-game-development-lesson-6/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/214/thumb.png" alt="HTML5 Game Development &#8211; Lesson 6" /> <br
/> HTML5 Game Development &#8211; Lesson 6</a></li><li> <a
href="http://www.script-tutorials.com/html5-game-development-lesson-5/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/205/thumb.png" alt="HTML5 Game Development &#8211; Lesson 5" /> <br
/> HTML5 Game Development &#8211; Lesson 5</a></li><li> <a
href="http://www.script-tutorials.com/html5-game-development-navigating-your-spaceship-lesson-3/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/166/thumb.png" alt="HTML5 Game Development &#8211; Navigating Your Spaceship- Lesson 3" /> <br
/> HTML5 Game Development &#8211; Navigating Your Spaceship- Lesson 3</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/html5-game-development-lesson-7/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>CSS3 Modal Popups</title><link>http://www.script-tutorials.com/css3-modal-popups/</link> <comments>http://www.script-tutorials.com/css3-modal-popups/#comments</comments> <pubDate>Fri, 20 Jan 2012 18:24:04 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[HTML/CSS]]></category> <category><![CDATA[css3]]></category> <category><![CDATA[css3 popup]]></category> <category><![CDATA[modal window]]></category><guid
isPermaLink="false">http://www.script-tutorials.com/?p=1377</guid> <description><![CDATA[CSS3 Modal Popups Today I will tell you how to create cool CSS3 modal popup windows (or boxes). Literally, not so long ago, in order to achieve such effects, we used jQuery. But, as it turned out, CSS3 has all the necessary tools for making modal windows too. In our demonstration I have prepared single [...]<div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/how-to-create-a-pure-css3-animated-buttons/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/184/thumb.png" alt="Creating Fantastic Animated Buttons using CSS3" /> Creating Fantastic Animated Buttons using CSS3</a></li><li> <a
href="http://www.script-tutorials.com/creating-css3-dropdown-menu/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/87/thumb.png" alt="Creating a cool CSS3 Dropdown Menu" /> Creating a cool CSS3 Dropdown Menu</a></li><li> <a
href="http://www.script-tutorials.com/creating-css3-dropdown-menu-4/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/102/thumb.png" alt="Creating A CSS3 Dropdown Menu #4" /> Creating A CSS3 Dropdown Menu #4</a></li></ol></div>]]></description> <content:encoded><![CDATA[<div
class="thumb"><img
width="128" height="128" class="aligncenter" title="CSS3 Modal Popups" alt="CSS3 Modal Popups" src="http://www.script-tutorials.com/demos/222/thumb.png"></div><p><strong>CSS3 Modal Popups</strong><br
/> <br
/>Today I will tell you how to create cool CSS3 modal popup windows (or boxes). Literally, not so long ago, in order to achieve such effects, we used jQuery. But, as it turned out, CSS3 has all the necessary tools for making modal windows too. In our demonstration I have prepared single page with two popup elements: join form and login form. Welcome to test results and understand how it was made.<br
/> <span
id="more-1377"></span></p><h5 style="text-align: center;"><strong><a
title="CSS3 Modal Popups - online demo" href="http://www.script-tutorials.com/demos/222/index.html" target="_blank">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="CSS3 Modal Popups - package" href="http://www.script-tutorials.com/demos/222/source.zip" target="_blank">download result</a></strong></h5><hr
/><p>Ok, download the example files and lets start !</p><hr
/><h3>Step 1. HTML</h3><p>First, lets create the main HTML markup. As you can see &#8211; the structure is quite easy. Here are one panel with buttons and two popups. Each of them contains own overlay DIV element and popup DIV element with some content inside and &#8216;close&#8217; button.</p><h4>index.html</h4><pre class="brush:html">
<!DOCTYPE html>
&lt;html lang=&quot;en&quot; &gt;
    &lt;head&gt;
        &lt;meta charset=&quot;utf-8&quot; /&gt;
        &lt;title&gt;CSS3 Modal Popups | Script Tutorials&lt;/title&gt;
        &lt;link href=&quot;css/layout.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
        &lt;link href=&quot;css/modal.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;header&gt;
            &lt;h2&gt;CSS3 Modal Popups&lt;/h2&gt;
            &lt;a href=&quot;http://www.script-tutorials.com/css3-modal-popups/&quot; class=&quot;stuts&quot;&gt;Back to original tutorial on &lt;span&gt;Script Tutorials&lt;/span&gt;&lt;/a&gt;
        &lt;/header&gt;

        &lt;!-- panel with buttons --&gt;
        &lt;div class=&quot;main&quot;&gt;
            &lt;div class=&quot;panel&quot;&gt;
                &lt;a href=&quot;#login_form&quot; id=&quot;login_pop&quot;&gt;Log In&lt;/a&gt;
                &lt;a href=&quot;#join_form&quot; id=&quot;join_pop&quot;&gt;Sign Up&lt;/a&gt;
            &lt;/div&gt;

        &lt;/div&gt;

        &lt;!-- popup form #1 --&gt;
        &lt;a href=&quot;#x&quot; class=&quot;overlay&quot; id=&quot;login_form&quot;&gt;&lt;/a&gt;
        &lt;div class=&quot;popup&quot;&gt;
            &lt;h2&gt;Welcome Guest!&lt;/h2&gt;
            &lt;p&gt;Please enter your login and password here&lt;/p&gt;
            &lt;div&gt;
                &lt;label for=&quot;login&quot;&gt;Login&lt;/label&gt;
                &lt;input type=&quot;text&quot; id=&quot;login&quot; value=&quot;&quot; /&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;label for=&quot;password&quot;&gt;Password&lt;/label&gt;
                &lt;input type=&quot;password&quot; id=&quot;password&quot; value=&quot;&quot; /&gt;
            &lt;/div&gt;
            &lt;input type=&quot;button&quot; value=&quot;Log In&quot; /&gt;

            &lt;a class=&quot;close&quot; href=&quot;#close&quot;&gt;&lt;/a&gt;
        &lt;/div&gt;

        &lt;!-- popup form #2 --&gt;
        &lt;a href=&quot;#x&quot; class=&quot;overlay&quot; id=&quot;join_form&quot;&gt;&lt;/a&gt;
        &lt;div class=&quot;popup&quot;&gt;
            &lt;h2&gt;Sign Up&lt;/h2&gt;
            &lt;p&gt;Please enter your details here&lt;/p&gt;
            &lt;div&gt;
                &lt;label for=&quot;email&quot;&gt;Login (Email)&lt;/label&gt;
                &lt;input type=&quot;text&quot; id=&quot;email&quot; value=&quot;&quot; /&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;label for=&quot;pass&quot;&gt;Password&lt;/label&gt;
                &lt;input type=&quot;password&quot; id=&quot;pass&quot; value=&quot;&quot; /&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;label for=&quot;firstname&quot;&gt;First name&lt;/label&gt;
                &lt;input type=&quot;text&quot; id=&quot;firstname&quot; value=&quot;&quot; /&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;label for=&quot;lastname&quot;&gt;Last name&lt;/label&gt;
                &lt;input type=&quot;text&quot; id=&quot;lastname&quot; value=&quot;&quot; /&gt;
            &lt;/div&gt;
            &lt;input type=&quot;button&quot; value=&quot;Sign Up&quot; /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;or&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;#login_form&quot; id=&quot;login_pop&quot;&gt;Log In&lt;/a&gt;

            &lt;a class=&quot;close&quot; href=&quot;#close&quot;&gt;&lt;/a&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre><h3>Step 2. CSS</h3><p>I omit styles of layout.css. Here are nothing interesting. The most interesting &#8211; next one file (where I have prepared all necessary styles for our modal popups):</p><h4>css/modal.css</h4><pre class="brush:css">
.main {
    background: #aaa url(../images/bg.jpg) no-repeat;
    width: 800px;
    height: 600px;
    margin: 50px auto;
}
.panel {
    background-color: #444;
    height: 34px;
    padding: 10px;
}
.panel a#login_pop, .panel a#join_pop {
    border: 2px solid #aaa;
    color: #fff;
    display: block;
    float: right;
    margin-right: 10px;
    padding: 5px 10px;
    text-decoration: none;
    text-shadow: 1px 1px #000;

    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    -ms-border-radius: 10px;
    -o-border-radius: 10px;
    border-radius: 10px;
}
a#login_pop:hover, a#join_pop:hover {
    border-color: #eee;
}
.overlay {
    background-color: rgba(0, 0, 0, 0.6);
    bottom: 0;
    cursor: default;
    left: 0;
    opacity: 0;
    position: fixed;
    right: 0;
    top: 0;
    visibility: hidden;
    z-index: 1;

    -webkit-transition: opacity .5s;
    -moz-transition: opacity .5s;
    -ms-transition: opacity .5s;
    -o-transition: opacity .5s;
    transition: opacity .5s;
}
.overlay:target {
    visibility: visible;
    opacity: 1;
}
.popup {
    background-color: #fff;
    border: 3px solid #fff;
    display: inline-block;
    left: 50%;
    opacity: 0;
    padding: 15px;
    position: fixed;
    text-align: justify;
    top: 40%;
    visibility: hidden;
    z-index: 10;

    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);

    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    -ms-border-radius: 10px;
    -o-border-radius: 10px;
    border-radius: 10px;

    -webkit-box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
    -moz-box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
    -ms-box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
    -o-box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;
    box-shadow: 0 1px 1px 2px rgba(0, 0, 0, 0.4) inset;

    -webkit-transition: opacity .5s, top .5s;
    -moz-transition: opacity .5s, top .5s;
    -ms-transition: opacity .5s, top .5s;
    -o-transition: opacity .5s, top .5s;
    transition: opacity .5s, top .5s;
}
.overlay:target+.popup {
    top: 50%;
    opacity: 1;
    visibility: visible;
}
.close {
    background-color: rgba(0, 0, 0, 0.8);
    height: 30px;
    line-height: 30px;
    position: absolute;
    right: 0;
    text-align: center;
    text-decoration: none;
    top: -15px;
    width: 30px;

    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    -ms-border-radius: 15px;
    -o-border-radius: 15px;
    border-radius: 15px;
}
.close:before {
    color: rgba(255, 255, 255, 0.9);
    content: &quot;X&quot;;
    font-size: 24px;
    text-shadow: 0 -1px rgba(0, 0, 0, 0.9);
}
.close:hover {
    background-color: rgba(64, 128, 128, 0.8);
}
.popup p, .popup div {
    margin-bottom: 10px;
}
.popup label {
    display: inline-block;
    text-align: left;
    width: 120px;
}
.popup input[type=&quot;text&quot;], .popup input[type=&quot;password&quot;] {
    border: 1px solid;
    border-color: #999 #ccc #ccc;
    margin: 0;
    padding: 2px;

    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -ms-border-radius: 2px;
    -o-border-radius: 2px;
    border-radius: 2px;
}
.popup input[type=&quot;text&quot;]:hover, .popup input[type=&quot;password&quot;]:hover {
    border-color: #555 #888 #888;
}
</pre><hr
/><h5 style="text-align: center;"><strong><a
title="CSS3 Modal Popups - demo 222" href="http://www.script-tutorials.com/demos/222/index.html" target="_blank" rel="nofollow">Live Demo</a></strong></h5><h5 style="text-align: center;"><strong><a
title="CSS3 Modal Popups - package" href="http://www.script-tutorials.com/demos/222/source.zip" target="_blank" rel="nofollow">download result</a></strong></h5><hr
/><h3>Conclusion</h3><p>Today we have made another great CSS3 demonstration &#8211; popup modal windows. Welcome back to read our new tutorials!</p><div
class="shr-publisher-1377"></div><div
id="main-related"><h4>Related Stuff You Will Love!</h4><ol
class="related-posts"><li> <a
href="http://www.script-tutorials.com/how-to-create-a-pure-css3-animated-buttons/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/184/thumb.png" alt="Creating Fantastic Animated Buttons using CSS3" /> <br
/> Creating Fantastic Animated Buttons using CSS3</a></li><li> <a
href="http://www.script-tutorials.com/creating-css3-dropdown-menu/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/87/thumb.png" alt="Creating a cool CSS3 Dropdown Menu" /> <br
/> Creating a cool CSS3 Dropdown Menu</a></li><li> <a
href="http://www.script-tutorials.com/creating-css3-dropdown-menu-4/" rel="bookmark"> <img
src="http://www.script-tutorials.com/demos/102/thumb.png" alt="Creating A CSS3 Dropdown Menu #4" /> <br
/> Creating A CSS3 Dropdown Menu #4</a></li></ol></div>]]></content:encoded> <wfw:commentRss>http://www.script-tutorials.com/css3-modal-popups/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic (User agent is rejected)
Database Caching using disk: basic

Served from: www.script-tutorials.com @ 2012-02-04 21:41:31 -->
