<?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>Amoeba Solution Kiosk &#187; CSS &amp; XHTML</title> <atom:link href="http://ask.amoeba.co.in/topics/css-xhtml/feed/" rel="self" type="application/rss+xml" /><link>http://ask.amoeba.co.in</link> <description>Providing solutions for PHP, MySQL, Flash, Flex, Action Script, Javascript, YUI, JQuery, CSS, XHTML problems.</description> <lastBuildDate>Fri, 30 Dec 2011 18:12:55 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>HTML5 Canvas Tutorial &amp; Example. Draw a Rainbow using Arc.</title><link>http://ask.amoeba.co.in/html5-canvas-tutorial-example-draw-a-rainbow-using-arc/</link> <comments>http://ask.amoeba.co.in/html5-canvas-tutorial-example-draw-a-rainbow-using-arc/#comments</comments> <pubDate>Fri, 17 Sep 2010 16:45:54 +0000</pubDate> <dc:creator>Aneeska</dc:creator> <category><![CDATA[CSS & XHTML]]></category> <category><![CDATA[Javascript & Libraries]]></category> <category><![CDATA[Programming Techniques]]></category> <category><![CDATA[Web 3.0]]></category> <category><![CDATA[arc]]></category> <category><![CDATA[browser]]></category> <category><![CDATA[canvas]]></category> <category><![CDATA[context]]></category> <category><![CDATA[demo]]></category> <category><![CDATA[draw]]></category> <category><![CDATA[example]]></category> <category><![CDATA[explorer canvas]]></category> <category><![CDATA[graphics]]></category> <category><![CDATA[html5]]></category> <category><![CDATA[marijn haverbeke]]></category> <category><![CDATA[rainbow]]></category> <category><![CDATA[tutorial]]></category> <guid
isPermaLink="false">http://ask.amoeba.co.in/?p=153</guid> <description><![CDATA[The world is slowly adopting HTML5 and it is time to move towards it. HTML5 incorporates many features which were achievable only using third party plug-ins. I am not talking about HTML5 in detail. I just want to give you some light on a great feature which HTML5 ships with, &#8220;Canvas&#8221;! &#8220;Canvas&#8221; which is an [...]]]></description> <content:encoded><![CDATA[<p>The world is slowly adopting HTML5 and it is time to move towards it. HTML5 incorporates many features which were achievable only using third party plug-ins. I am not talking about HTML5 in detail. I just want to give you some light on a great feature which HTML5 ships with, &#8220;Canvas&#8221;!</p><p>&#8220;Canvas&#8221; which is an HTML5 tag, allows you to render graphics or visual images on the fly through programming in a browser. Very similar to generating graphics (drawing shapes) in Flash using the BitmapData class. To implement canvas in your webpage, you need to define a &#8220;canvas&#8221; tag in your mark up just like how you define any other container tag like &#8220;div&#8221;.</p><pre class="brush: xml; title: ; notranslate">
&lt;canvas id=&quot;myCanvas&quot; width=&quot;500&quot; height=&quot;200&quot;&gt;&lt;/canvas&gt;
</pre><p>A canvas object contains a drawing context, which is where we draw graphics. This context can be accessed using Javascript. HTML5 has now defined only a &#8220;2D&#8221; context in a canvas. The future release of HTML5 may contain a 3D context as well. Let&#8217;s now see how to access this 2D context and start drawing.</p><pre class="brush: jscript; title: ; notranslate">
&lt;script&gt;
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
&lt;/script&gt;
</pre><p>The context has many methods associated with it which allows us to draw various shapes, fill colors, define styles etc. See the example below which draws a Rainbow in a Canvas. The rainbow is created by drawing 7 circles with different radiuses. You don&#8217;t see the full circles because I didn&#8217;t define a height for the canvas. The canvas has now the default height and it crops the rest of the part. Play with the code and let me know if you have any questions.</p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;html&gt;
&lt;body&gt;
&lt;canvas id=&quot;myCanvas&quot;&gt;&lt;/canvas&gt;
&lt;script&gt;
var canvas = document.getElementById('myCanvas');
canvas.width = width = 470;
var context = canvas.getContext('2d');
var drawCircle = function(color, x, y, radius){
  context.arc(x, y, radius, 0, Math.PI*2, 0);
  context.fillStyle = '#' + 'ceff99ff78f86eeaaffffd45333'.substr(color*3,3);
  context.fill();
  context.beginPath();
};
for(i=0; i&lt;7; i++){
	drawCircle(i%7, width/2, width/2, 250-15*(i+1));
}
&lt;/script&gt;
&lt;/body&gt;
</pre><p>The best part about the canvas is that, you can save a rendered graphics in the browser as an image by choosing Save Image As from the canvas context menu. I am not sure this feature is available in all the browsers.</p><p>Among the versions in Internet Explorer, IE 9 is the only browser which supports HTML5 and canvas. Other Major browsers have been supporting HTML5 for quite a while. To enable canvas feature in IE7+, developers can include a JS library named <strong>Explorer Canvas</strong> in their code. Download it here: <a
href="http://code.google.com/p/explorercanvas/downloads/detail?name=excanvas_r3.zip">http://code.google.com/p/explorercanvas/downloads/detail?name=excanvas_r3.zip</a></p><p>The above example code is a simplified version of code written by Marijn Haverbeke.<br
/> For a complete documentation on Canvas, see <a
href="https://developer.mozilla.org/en/Canvas_tutorial/Drawing_shapes">https://developer.mozilla.org/en/Canvas_tutorial/Drawing_shapes</a></p><p>Enjoy!</p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fask.amoeba.co.in%2Fhtml5-canvas-tutorial-example-draw-a-rainbow-using-arc%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:65px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://ask.amoeba.co.in/html5-canvas-tutorial-example-draw-a-rainbow-using-arc/"></g:plusone></div><div
style="float:left; width:100px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://ask.amoeba.co.in/html5-canvas-tutorial-example-draw-a-rainbow-using-arc/"  data-text="HTML5 Canvas Tutorial &#038; Example. Draw a Rainbow using Arc." data-count="horizontal" data-via="aneesme">Tweet</a></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://ask.amoeba.co.in/html5-canvas-tutorial-example-draw-a-rainbow-using-arc/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ask.amoeba.co.in/html5-canvas-tutorial-example-draw-a-rainbow-using-arc/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://ask.amoeba.co.in/html5-canvas-tutorial-example-draw-a-rainbow-using-arc/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Enhance your Website Performance &#8211; Best Practices</title><link>http://ask.amoeba.co.in/enhance-your-website-performance-best-practices/</link> <comments>http://ask.amoeba.co.in/enhance-your-website-performance-best-practices/#comments</comments> <pubDate>Thu, 22 Apr 2010 14:13:39 +0000</pubDate> <dc:creator>Aneeska</dc:creator> <category><![CDATA[CSS & XHTML]]></category> <category><![CDATA[Enterprise Web]]></category> <category><![CDATA[Javascript & Libraries]]></category> <category><![CDATA[PHP/MySQL]]></category> <category><![CDATA[Programming Techniques]]></category> <guid
isPermaLink="false">http://ask.amoeba.co.in/?p=104</guid> <description><![CDATA[Do you think your website is sluggish? Does it take a lot of time to download on to a user computer? Here are some techniques to make your site load faster on user computers and enhance it's performance. These are some of the best practices followed in the Web industry. Implementing these practices has proved that your site will become 20-30% faster. This tutorial is for advanced users and I haven't explained it in detail.]]></description> <content:encoded><![CDATA[<p>Do you think your website is sluggish? Does it take a lot of time to download on to a user computer? Here are some techniques to make your site load faster on user computers and enhance it&#8217;s performance. These are some of the best practices followed in the Web industry. Implementing these practices has proved that your site will become 20-30% faster. This tutorial is for advanced users and I haven&#8217;t explained it in detail.</p><p><strong>Combine all your Javascript files and CSS files in to one file each. </strong><br
/> Normally we include multiple Script files in web pages. You can probably write a PHP script which accepts an array of names of all the script files to be included in the webpage which then fetches the content of the files and creates just one file and passes on to the browser. This doesn&#8217;t reduce the file size. The combined file size is not less than the sum of the sizes of the individual files. But it reduces the number of HTTP requests sent to your server.</p><p>Similarly you can combine all your icon/background images in to a single image and use CSS techniques like &#8220;background-position&#8221; to show different images at different places. Remember each image causes an HTTP request and you can reduce a lot of requests doing this way.</p><p><strong>Use YUI Compressor to minify your Javascrip and CSS files. </strong><br
/> When code is minified all comments are removed, as well as unneeded white space characters (space, newline, and tab). In the case of JavaScript, this improves response time performance because the size of the downloaded file is reduced.</p><p><strong>Add Never Expires header for your Javascript and CSS files</strong><br
/> You can use Apaches <strong>mod_expires</strong> module to set Cache-Control header for certain file types. You can configure your apache configuration to add statements like this,<br
/> <em>ExpiresByType image/gif &#8220;access plus 1 months&#8221;</em><br
/> You can add Never expires header for your Javascript and CSS files. If you constantly make changes to your Script and CSS files you will have to rename the files every time you make changes.</p><p><strong>Enable Compression</strong><br
/> Enable compression using Gzip. 90% of the browsers support this. You can compress your text content, xml, script files etc but not images.</p><p><strong>Stylesheets in your header</strong><br
/> Make sure that your style sheets are inside the Head tag.</p><p>These are some simple things you can implement but will obviously enhance your website performance.</p><p>Good luck!</p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fask.amoeba.co.in%2Fenhance-your-website-performance-best-practices%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:65px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://ask.amoeba.co.in/enhance-your-website-performance-best-practices/"></g:plusone></div><div
style="float:left; width:100px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://ask.amoeba.co.in/enhance-your-website-performance-best-practices/"  data-text="Enhance your Website Performance &#8211; Best Practices" data-count="horizontal" data-via="aneesme">Tweet</a></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://ask.amoeba.co.in/enhance-your-website-performance-best-practices/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ask.amoeba.co.in/enhance-your-website-performance-best-practices/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://ask.amoeba.co.in/enhance-your-website-performance-best-practices/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Alternate Table Row Color Styling or Zebra Table using Prototype</title><link>http://ask.amoeba.co.in/alternate-table-row-color-styling-or-zebra-table-using-prototype/</link> <comments>http://ask.amoeba.co.in/alternate-table-row-color-styling-or-zebra-table-using-prototype/#comments</comments> <pubDate>Fri, 05 Mar 2010 07:22:29 +0000</pubDate> <dc:creator>Aneeska</dc:creator> <category><![CDATA[CSS & XHTML]]></category> <category><![CDATA[Javascript & Libraries]]></category> <category><![CDATA[css]]></category> <category><![CDATA[prototype]]></category> <category><![CDATA[zebra style]]></category> <guid
isPermaLink="false">http://ask.amoeba.co.in/?p=101</guid> <description><![CDATA[This tutorial teaches you to easily apply Zebra styling to your static/dynamic tables. The method of styling alternate rows with different colors is also known as Zebra styling. We normally achieve this by defining two sets of styles for odd and even rows of a table and manually adding these class names in to the [...]]]></description> <content:encoded><![CDATA[<p>This tutorial teaches you to easily apply Zebra styling to your static/dynamic tables. The method of styling alternate rows with different colors is also known as <strong>Zebra styling</strong>. We normally achieve this by defining two sets of styles for odd and even rows of a table and manually adding these class names in to the table rows. When the data table is generated dynamically we use programming techniques to apply styles to alternate rows.</p><p>Here is a simple method using Prototype. This way, all you need to do is to define a class name for your table and prototype will automatically apply the odd table style to alternate rows of the table.</p><p>Let&#8217;s look at our table structure.</p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;ListTable&quot;&gt;
  &lt;tr&gt;
    &lt;th&gt;ID&lt;/th&gt;
    &lt;th&gt;TITLE&lt;/th&gt;
    &lt;th&gt;DATE&lt;/th&gt;
    &lt;th&gt;STATUS&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;Microsoft Launches first Android application&lt;/td&gt;
    &lt;td&gt;Mar 05, 2010&lt;/td&gt;
    &lt;td&gt;New&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;Another title&lt;/td&gt;
    &lt;td&gt;Mar 05, 2010&lt;/td&gt;
    &lt;td&gt;New&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;Google's new innovation&lt;/td&gt;
    &lt;td&gt;Mar 05, 2010&lt;/td&gt;
    &lt;td&gt;New&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;Microsoft Launches first Android application&lt;/td&gt;
    &lt;td&gt;Mar 05, 2010&lt;/td&gt;
    &lt;td&gt;New&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
</pre><p>Note that I have defined &#8220;<strong>ListTable</strong>&#8221; as the class name for the table and nothing else.</p><p>Now in the head section of the html, include prototype Javascript Library.</p><p><strong>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;prototype.js&#8221;&gt;&lt;/script&gt;</strong></p><p>You can download Prototype Library from here: <strong><a
href="http://www.prototypejs.org/download" target="_blank">http://www.prototypejs.org/download</a></strong></p><p>This is the basic styles we will define for the table with a class &#8220;<strong>ListTable</strong>&#8220;:</p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;style&gt;
.ListTable {
	border-left:1px solid #202020;
	border-right:1px solid #202020;
	font-family:&quot;Trebuchet MS&quot;, Arial, Helvetica, sans-serif;
	font-size:11px;
	text-align:left;
	background-color:#1e1e1e;
}
.ListTable th, table.ListTable th {
	background-color:#161614;
	height:26px;
	vertical-align:middle;
	padding-left:10px;
	text-align:left;
	font-weight:normal;
	text-transform:uppercase;
	color:#b7b7b7;
}
.oddRow, tr.oddRow {
	background-color:#494949;
}
&lt;/style&gt;
</pre><p>Now, add the below piece of Javascript in your html. This script will be called when the DOM is ready (similar to Window.onLoad).</p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;script&gt;
document.observe('dom:loaded', function(){
	$$('table.ListTable tr:nth-child(odd)').invoke(&quot;addClassName&quot;, &quot;oddRow&quot;);
});
&lt;/script&gt;
</pre><p>Notice that we are applying a class named &#8220;<strong>oddRow</strong>&#8221; to alternate table rows in the table which has a class applied &#8220;<strong>ListTable</strong>&#8220;.</p><p>Here is a screen shot of the table generated using the above method.<br
/> <a
href="http://ask.amoeba.co.in/wp-content/uploads/2010/03/zebra_table.jpg"><img
class="alignleft size-full wp-image-102" title="zebra_table" src="http://ask.amoeba.co.in/wp-content/uploads/2010/03/zebra_table.jpg" alt="zebra_table" width="430" height="92" /></a></p><p>Enjoy!</p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fask.amoeba.co.in%2Falternate-table-row-color-styling-or-zebra-table-using-prototype%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:65px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://ask.amoeba.co.in/alternate-table-row-color-styling-or-zebra-table-using-prototype/"></g:plusone></div><div
style="float:left; width:100px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://ask.amoeba.co.in/alternate-table-row-color-styling-or-zebra-table-using-prototype/"  data-text="Alternate Table Row Color Styling or Zebra Table using Prototype" data-count="horizontal" data-via="aneesme">Tweet</a></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://ask.amoeba.co.in/alternate-table-row-color-styling-or-zebra-table-using-prototype/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ask.amoeba.co.in/alternate-table-row-color-styling-or-zebra-table-using-prototype/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://ask.amoeba.co.in/alternate-table-row-color-styling-or-zebra-table-using-prototype/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>POSTing unselected OPTIONS in a SELECT tag</title><link>http://ask.amoeba.co.in/posting-unselected-options-in-a-select-tag/</link> <comments>http://ask.amoeba.co.in/posting-unselected-options-in-a-select-tag/#comments</comments> <pubDate>Mon, 15 Feb 2010 16:27:00 +0000</pubDate> <dc:creator>Aneeska</dc:creator> <category><![CDATA[CSS & XHTML]]></category> <category><![CDATA[Javascript & Libraries]]></category> <category><![CDATA[PHP/MySQL]]></category> <guid
isPermaLink="false">http://ask.amoeba.co.in/?p=96</guid> <description><![CDATA[When a form is submitted to the server, only selected values in a multiple SELECT box reaches the server. It is not possible to access the unselected options in a SELECT box from the server. Though this is not really required always, there are situations where you would want to access all the options in [...]]]></description> <content:encoded><![CDATA[<p>When a form is submitted to the server, only selected values in a multiple SELECT box reaches the server. It is not possible to access the unselected options in a SELECT box from the server. Though this is not really required always, there are situations where you would want to access all the options in a SELECT tag. One example is, when you allow users to select and move options from one SELECT box to another and the second SELECT box represents the user selection.</p><p>The below function can be called before a form is submitted and it will read all the options in a SELECT box and will append to the form as a multiple selection INPUT field. Thus, the server will be able to read the value as an array or options.</p><p>This example also gives you an idea how an INPUT array form element is created using Javascript.</p><p>The form could look like this.</p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;form action=&quot;move_select.html&quot; method=&quot;get&quot; onsubmit=&quot;return postSelect(this);&quot;&gt;
  &lt;select name=&quot;multipleValues[]&quot; id=&quot;multipleValues&quot; size=&quot;5&quot; multiple&gt;
    &lt;option value=&quot;1&quot;&gt;America&lt;/option&gt;
    &lt;option value=&quot;2&quot;&gt;Canada&lt;/option&gt;
    &lt;option value=&quot;3&quot;&gt;China&lt;/option&gt;
    &lt;option value=&quot;4&quot;&gt;England&lt;/option&gt;
  &lt;/select&gt;
  &lt;input name=&quot;Submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;
&lt;/form&gt;
</pre><p>Here is the Javascript which will be called before the form is submitted. The id of the Multiple SELECT box is &#8220;multipleValues&#8221;. The script loops through the select box and appends it as an input array element to the FORM and submit the form to the server.</p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;script&gt;
function postSelect(daForm) {
	var postAll;
	var sB = document.getElementById(&quot;multipleValues&quot;);
	for(var k=0; k&lt;sB.length; k++){
		postAll = document.createElement(&quot;input&quot;);
		postAll.setAttribute(&quot;type&quot;, &quot;hidden&quot;);
		postAll.setAttribute(&quot;name&quot;, &quot;selectBoxData[]&quot;);
		postAll.setAttribute(&quot;value&quot;, sB[k].value);
		daForm.appendChild(postAll) ;
	}
	return false;
}
&lt;/script&gt;
</pre><p>Now in your server script, you can access the options (unselected) in the SELECT box as an array.</p><p>The php code for accessing the above SELECT box values would be this. Here, you can access &#8220;selectBoxData&#8221; as an array.</p><pre class="brush: php; html-script: true; title: ; notranslate">
print_r($_POST['selectBoxData']);
</pre><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fask.amoeba.co.in%2Fposting-unselected-options-in-a-select-tag%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:65px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://ask.amoeba.co.in/posting-unselected-options-in-a-select-tag/"></g:plusone></div><div
style="float:left; width:100px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://ask.amoeba.co.in/posting-unselected-options-in-a-select-tag/"  data-text="POSTing unselected OPTIONS in a SELECT tag" data-count="horizontal" data-via="aneesme">Tweet</a></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://ask.amoeba.co.in/posting-unselected-options-in-a-select-tag/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ask.amoeba.co.in/posting-unselected-options-in-a-select-tag/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://ask.amoeba.co.in/posting-unselected-options-in-a-select-tag/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>HTML Form &#8211; Moving options from one SELECT to another</title><link>http://ask.amoeba.co.in/moving-options-from-one-select-to-another/</link> <comments>http://ask.amoeba.co.in/moving-options-from-one-select-to-another/#comments</comments> <pubDate>Mon, 15 Feb 2010 16:07:43 +0000</pubDate> <dc:creator>Aneeska</dc:creator> <category><![CDATA[CSS & XHTML]]></category> <category><![CDATA[Javascript & Libraries]]></category> <guid
isPermaLink="false">http://ask.amoeba.co.in/?p=94</guid> <description><![CDATA[This article basically talks about two things. 1) A Javascript code to move options from one multiple select box to another in a form. Move options from one SELECT box to another: There are two multiple SELECT boxes and one has got some OPTIONS in it. User can select one or more options from one [...]]]></description> <content:encoded><![CDATA[<p>This article basically talks about two things.</p><p>1) A Javascript code to move options from one multiple select box to another in a form.</p><p><strong>Move options from one SELECT box to another:</strong></p><p>There are two multiple SELECT boxes and one has got some OPTIONS in it. User can select one or more options from one and click on the Move button to transfer the selected options in to the other one. Similarly, the selected options from the second SELECT box can be moved back to the first one.</p><p>Here is the HTML Code:</p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;form action=&quot;&quot; method=&quot;post&quot;&gt;
  &lt;table width=&quot;250&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
    &lt;tr&gt;
      &lt;td width=&quot;100&quot;&gt;&lt;select name=&quot;SourceSelect[]&quot; id=&quot;sourceSelect&quot; size=&quot;5&quot; multiple ondblclick=&quot;moveData(); return false;&quot;&gt;
          &lt;option value=&quot;1&quot;&gt;America&lt;/option&gt;
          &lt;option value=&quot;2&quot;&gt;Canada&lt;/option&gt;
          &lt;option value=&quot;3&quot;&gt;China&lt;/option&gt;
          &lt;option value=&quot;4&quot;&gt;England&lt;/option&gt;
        &lt;/select&gt;&lt;/td&gt;
      &lt;td width=&quot;100&quot; align=&quot;center&quot; valign=&quot;middle&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;forward&quot; id=&quot;button&quot; value=&quot;&gt;&gt;&gt;&gt;&quot; onclick=&quot;moveData(); return false;&quot;/&gt;
        &lt;input type=&quot;submit&quot; name=&quot;back&quot; id=&quot;button&quot; value=&quot;&lt;&lt;&lt;&lt;&quot; onclick=&quot;moveData('back'); return false;&quot;/&gt;&lt;/td&gt;
      &lt;td align=&quot;left&quot;&gt;&lt;select name=&quot;DestinationSelect[]&quot; id=&quot;destinationSelect&quot; size=&quot;5&quot; multiple=&quot;multiple&quot; ondblclick=&quot;moveData('back'); return false;&quot;&gt;
        &lt;/select&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/form&gt;
</pre><p>And here is the Javascript code:</p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; language=&quot;javascript1.2&quot;&gt;
function moveData(dir) {
	var sF = document.getElementById(((dir == &quot;back&quot;)?&quot;destinationSelect&quot;:&quot;sourceSelect&quot;));
	var dF = document.getElementById(((dir == &quot;back&quot;)?&quot;sourceSelect&quot;:&quot;destinationSelect&quot;));
	if(sF.length == 0 || sF.selectedIndex == -1) return;
	while (sF.selectedIndex != -1) {
		dF.options[dF.length] = new Option(sF.options[sF.selectedIndex].text, sF.options[sF.selectedIndex].value);
		sF.options[sF.selectedIndex] = null;
	}
}
&lt;/script&gt;
</pre><p>The above code also allows you to double click on a select option to move it to the other.</p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fask.amoeba.co.in%2Fmoving-options-from-one-select-to-another%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:65px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://ask.amoeba.co.in/moving-options-from-one-select-to-another/"></g:plusone></div><div
style="float:left; width:100px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://ask.amoeba.co.in/moving-options-from-one-select-to-another/"  data-text="HTML Form &#8211; Moving options from one SELECT to another" data-count="horizontal" data-via="aneesme">Tweet</a></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://ask.amoeba.co.in/moving-options-from-one-select-to-another/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ask.amoeba.co.in/moving-options-from-one-select-to-another/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://ask.amoeba.co.in/moving-options-from-one-select-to-another/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Dead Center layout using CSS</title><link>http://ask.amoeba.co.in/dead-center-layout-using-css/</link> <comments>http://ask.amoeba.co.in/dead-center-layout-using-css/#comments</comments> <pubDate>Sat, 12 Dec 2009 20:31:05 +0000</pubDate> <dc:creator>Aneeska</dc:creator> <category><![CDATA[CSS & XHTML]]></category> <category><![CDATA[align]]></category> <category><![CDATA[center]]></category> <category><![CDATA[css]]></category> <category><![CDATA[css trick]]></category> <category><![CDATA[dead center]]></category> <category><![CDATA[div]]></category> <category><![CDATA[horizontal center align]]></category> <category><![CDATA[horizontally]]></category> <category><![CDATA[vertical center align]]></category> <category><![CDATA[vertically]]></category> <guid
isPermaLink="false">http://ask.amoeba.co.in/?p=22</guid> <description><![CDATA[This tutorial shows you how to align a div object vertically center in any browser. This is a very easy way of doing it and it uses fairly simple CSS. It also shows you how to horizontally and vertically align text inside a div. This is basically a  CSS trick with some hacks for different browsers for this to work well in all the major browsers. Download the attached HTML file and test it yourself. If you have any questions, just ASK!]]></description> <content:encoded><![CDATA[<p>How many  of you have searched Google for “dead center align” or “vertical center css” and  found results showing more than a million pages only to realize that most of  them don’t give you the right solution you are looking for? Well, vertical  centering has always been a nightmare for designers and developers. The  solution we are looking at is not just limited to aligning text vertically  center inside a container or a div tag. We need to vertically and horizontally  center a div container in a browser. We need to align an object (a div or a  table) whose height is unknown, inside a div.</p><p>The  concept of aligning a div vertically center in a browser is pretty simple. It  is achieved by absolutely positioning a div in half of the area height and  moving up by half of its height. This is possible when you know the height of  the div. Let’s see how it works. Here is the css style defined for the wrapper  div with an ID “box”. The important thing to note here is the “left” and “top”  parameters. These values are defined in percentage values. This really helps  you to position a div in the center even when you don’t know the resolution of  the browser screen. The top-left corner of the div is now sits in the center  point of the browser. The next thing to do is move up the div half of its  height and move left the div half of its width. This way the center point of  the div is aligned to the center point of the browser. This is done by defining  negative values for “margin-top” and “margin-left” attributes. See the css  below.</p><p><pre class="brush: php; html-script: true; title: ; notranslate">
#box {
  width:300px;
  height:120px;
  position:absolute;
  margin-left:-150px;
  margin-top:-60px;
  left:50%;
  top:50%;
  text-align:center;
  }
</pre></p><p>We have  formed a div with a dimension of 300&#215;120 and placed it in the center of the  browser. Now, we need to have some text inside this wrapper div which should be  again centered inside div both vertically and horizontally. In this case, we  need to use some browser hacks and tricks. See the html code and we have now  additional div tags to wrap the text and styles targeting different browsers.</p><p><pre class="brush: php; html-script: true; title: ; notranslate">
&lt;style&gt;
#box&gt;#floating { /*display:table for Mozilla &amp; Opera*/
	display:table;
	position:static;
}
#floating { /*for IE*/
	width:300px;
	height:100%;
	position:relative;
}
#floating div { /*for IE*/
	position:absolute;
	top:50%;
	left:0px;
	width:100%;
}
#floating&gt;div { /*for Mozilla and Opera*/
	display:table-cell;
	vertical-align:middle;
	position:static;
}
#floating div div {
	position:relative;
	top:-50%;
}
&lt;/style&gt;
&lt;div id=&quot;box&quot;&gt;
    &lt;div id=&quot;floating&quot;&gt;
        &lt;div&gt;&lt;div&gt;
             &lt;p&gt;The text is vertically and horizontally aligned center&lt;br /&gt;
				as is the wrapper div. You can use a table as well without a height.&lt;/p&gt;
        &lt;/div&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre></p><p>Now what  do you do when you want to vertically align a div or table whose height is not  pre-defined? Simple! Set the height of the wrapper div to 100% and remove “top”  and “margin-top” attributes. Now in the above html code, remove the text with a  table or a div tag which doesn’t have a defined height. It works! Download  the code and experiment it yourselves. If you found something more interesting,  let us all know. Hope it helped.</p><p><strong>Here is the full code download link:</strong> <a
class="dLink" href="http://ask.amoeba.co.in/wp-content/uploads/2009/12/deadcenter.zip">Dead Center align a DIV using CSS</a></p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fask.amoeba.co.in%2Fdead-center-layout-using-css%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:65px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://ask.amoeba.co.in/dead-center-layout-using-css/"></g:plusone></div><div
style="float:left; width:100px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://ask.amoeba.co.in/dead-center-layout-using-css/"  data-text="Dead Center layout using CSS" data-count="horizontal" data-via="aneesme">Tweet</a></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://ask.amoeba.co.in/dead-center-layout-using-css/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ask.amoeba.co.in/dead-center-layout-using-css/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://ask.amoeba.co.in/dead-center-layout-using-css/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
