<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-22250331</id><updated>2012-01-28T20:51:20.562-08:00</updated><title type='text'>Code Cooking</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codecooking.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22250331/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://codecooking.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Uday</name><uri>http://www.blogger.com/profile/06403913402454501058</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-22250331.post-114102523071809595</id><published>2006-02-26T23:25:00.000-08:00</published><updated>2006-03-14T07:41:45.360-08:00</updated><title type='text'>Toggling Email style Checkboxes</title><content type='html'>&lt;quote&gt;Web-based Email type Selection of multiple check boxes with single check box toggle&lt;/quote&gt;&lt;br /&gt;&lt;br /&gt;This example explains how we can easily select multiple checkboxes by selecting a single checkbox. &lt;br /&gt;&lt;br /&gt;Remember your mailbox? Yes, you select a checkbox and all the checkboxes in the array that follows are selected. Well, this is an example of task-centred design. The user need not select all the mails that he wants to delete one by one, but check just one checkbox to trigger them all. &lt;br /&gt;&lt;br /&gt;Similarly, we can use the following to choose all books from a shopping cart that we intend to buy, rather than pick them one by one. All said and done, let's get started with the &lt;a href="http://www.freewebs.com/codecooking/toggling_email_style_heckboxes.html" target="_blank"&gt;raw example&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Functionality:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. By default all checkboxes will be checked.&lt;br /&gt;2. Under Collections group when “Search All Collections” checkbox is checked all its collections are checked.&lt;br /&gt;3. When “Search All Collections” checkbox is unchecked means all its collections are unchecked.&lt;br /&gt;4. When any one collection is unchecked then the “Search All Collections” checkbox should be unchecked.&lt;br /&gt;5. When all collections are checked then “Search All Collections” checkbox will be checked.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Loading the JavaScript&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The JavaScript code has to be included in the &amp;lt;head&amp;gt; of the &lt;a href="http://www.freewebs.com/codecooking/toggling_email_style_heckboxes.html" target="_blank"&gt;HTML Example&lt;/a&gt; page, below is the code which has to be included in &amp;lt;head&amp;gt; part.&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;script type="text/javascript" language="javascript"&amp;gt;&lt;br /&gt;//Function to check and uncheck all the collections under Collections group&lt;br /&gt;function unchk()&lt;br /&gt;{&lt;br /&gt;//Chceking for “Search All Collections” is unchecked&lt;br /&gt;if (document.formMultiCheck.All.checked == false)&lt;br /&gt;{&lt;br /&gt;//If “Search All Collections” is unchecked, this code makes all the collections under it uncheck&lt;br /&gt;for (i=0; i&amp;lt;document.formMultiCheck.Collections.length; i++)&lt;br /&gt;document.formMultiCheck.Collections[i].checked = false&lt;br /&gt;}&lt;br /&gt;//Chceking for “Search All Collections” is checked&lt;br /&gt;if (document.formMultiCheck.All.checked == true)&lt;br /&gt;{&lt;br /&gt;//If “Search All Collections” is checked, this code makes all the collections under it checked&lt;br /&gt;for (i=0;i&amp;lt;document.formMultiCheck.Collections.length;i++)&lt;br /&gt;document.formMultiCheck.Collections[i].checked = true&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;//Function to check the state of individual collection and its effect on “Search All Collections” check box&lt;br /&gt;function chk()&lt;br /&gt;{&lt;br /&gt;for (i=0;i&amp;lt;document.formMultiCheck.Collections.length;i++)&lt;br /&gt;//If any collection is unchecked it will change the state of “Search All Collections” check box to unchecked, this is achieved by “return” statement.&lt;br /&gt;if (document.formMultiCheck.Collections[i].checked == false)&lt;br /&gt;{&lt;br /&gt;document.formMultiCheck.All.checked = false&lt;br /&gt;return&lt;br /&gt;}&lt;br /&gt;for (i=0;i&amp;lt;document.formMultiCheck.Collections.length;i++)&lt;br /&gt;//If all collection are checked, it will change the state of  “Search All Collections” check box to checked.&lt;br /&gt;if (document.formMultiCheck.Collections[i].checked == true)&lt;br /&gt;{&lt;br /&gt;document.formMultiCheck.All.checked = true&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="technorati"&gt;&lt;br /&gt;Technorati tags: &lt;a href="http://technorati.com/tag/JavaScript" rel="tag"&gt;JavaScript&lt;/a&gt;, &lt;a href="http://technorati.com/tag/web2.0" rel="tag"&gt;web2.0&lt;/a&gt;, &lt;a href="http://technorati.com/tag/ajax" rel="tag"&gt;ajax&lt;/a&gt;, &lt;a href="http://technorati.com/tag/checkbox" rel="tag"&gt;checkbox&lt;/a&gt;, &lt;a href="http://technorati.com/tag/programming" rel="tag"&gt;programming&lt;/a&gt;, &lt;a href="http://technorati.com/tag/design" rel="tag"&gt;design&lt;/a&gt;, &lt;a href="http://technorati.com/tag/task-centric" rel="tag"&gt;task-centric&lt;/a&gt;, &lt;a href="http://technorati.com/tag/toggle" rel="tag"&gt;toggle&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22250331-114102523071809595?l=codecooking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codecooking.blogspot.com/feeds/114102523071809595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22250331&amp;postID=114102523071809595' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22250331/posts/default/114102523071809595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22250331/posts/default/114102523071809595'/><link rel='alternate' type='text/html' href='http://codecooking.blogspot.com/2006/02/toggling-email-style-checkboxes.html' title='Toggling Email style Checkboxes'/><author><name>Uday</name><uri>http://www.blogger.com/profile/06403913402454501058</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-22250331.post-114010622569711597</id><published>2006-02-16T08:09:00.000-08:00</published><updated>2006-02-17T07:02:56.843-08:00</updated><title type='text'>Toggle Button</title><content type='html'>&lt;strong&gt;Want to make a toggle button? Eat this:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Here is a simple toggle button using JavaScript, it is like an on/off switch. Using this button you can enable or disable the select field(you can use any element).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.freewebs.com/codecooking/togglebutton.html" target="_blank"&gt;Check the Example&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;How does it work(Or what your PM wants you to do)?&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;When you click on the button it should make the input/select field disabled or enabled.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Button value(the text that appears on the button) should be changed to enabled when the input/select field is disabled and vice versa.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;strong&gt;Loading the JavaScript&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The JavaScript code has to be included in the &amp;lt;head&amp;gt; of the html page, below is the code which has to be included in &amp;lt;head&amp;gt; tag.&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;&lt;br /&gt;function toggle()&lt;br /&gt;{&lt;br /&gt;//Checking if select field is enabled&lt;br /&gt;if (document.getElementById("mySelect").disabled == false)&lt;br /&gt;{&lt;br /&gt;//Changing the select field state to disabled and changing the value of button to enable&lt;br /&gt;document.getElementById("mySelect").disabled = true&lt;br /&gt;document.getElementById("btn").value="Enable list"&lt;br /&gt;return&lt;br /&gt;}&lt;br /&gt;//Checking if select field is disabled&lt;br /&gt;if (document.getElementById("mySelect").disabled == true)&lt;br /&gt;{&lt;br /&gt;//Changing the select field state to enabled and changing the value of button to disable&lt;br /&gt;document.getElementById("mySelect").disabled = false&lt;br /&gt;document.getElementById("btn").value="Disable list"&lt;br /&gt;return&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;Html Code&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Create a select field and a button in body section, below is the code which has to be included in &amp;lt;body&amp;gt; tag.&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;form&amp;gt;&lt;br /&gt;&amp;lt;select id="mySelect"&amp;gt;&lt;br /&gt;   &amp;lt;option&amp;gt;Apple&amp;lt;/option&amp;gt; &lt;br /&gt;   &amp;lt;option&amp;gt;Pear&amp;lt;/option&amp;gt;&lt;br /&gt;   &amp;lt;option&amp;gt;Banana&amp;lt;/option&amp;gt;&lt;br /&gt;   &amp;lt;option&amp;gt;Orange&amp;lt;/option&amp;gt;  &lt;br /&gt;&amp;lt;/select&amp;gt;&lt;br /&gt;&amp;lt;input id="btn" onclick="toggle()" value="Disable list" type="button"&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Hope you like the stuff. More to come your way! Stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22250331-114010622569711597?l=codecooking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codecooking.blogspot.com/feeds/114010622569711597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=22250331&amp;postID=114010622569711597' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/22250331/posts/default/114010622569711597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/22250331/posts/default/114010622569711597'/><link rel='alternate' type='text/html' href='http://codecooking.blogspot.com/2006/02/toggle-button_16.html' title='Toggle Button'/><author><name>Uday</name><uri>http://www.blogger.com/profile/06403913402454501058</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry></feed>
