<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: select code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 01:05:33 GMT</pubDate>
    <description>DZone Snippets: select code</description>
    <item>
      <title>date_select conversion</title>
      <link>http://snippets.dzone.com/posts/show/5376</link>
      <description>function to convert a value from a date_select into a more sql-friendly value&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;%=date_select(:date,'',:start_year =&gt; 1950,:include_blank =&gt; false, :default =&gt; { :year =&gt; '1970' })%&gt;&lt;br /&gt;&lt;br /&gt;def convert_date(obj) &lt;br /&gt;  return &#8220;#{obj[&#8216;(1i)&#8217;]}-#{obj[&#8216;(2i)&#8217;]}-#{obj[&#8216;(3i)&#8217;]}&#8221; &lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 17 Apr 2008 13:20:35 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5376</guid>
      <author>indiehead (John)</author>
    </item>
    <item>
      <title>PHP Select Form Helper</title>
      <link>http://snippets.dzone.com/posts/show/5035</link>
      <description>// takes an array of values and a value to match, and outputs formatted &lt;option&gt;s with the &lt;option&gt; matching $match selected&lt;br /&gt;// must be manually wrapped in &lt;select&gt;&lt;/select to allow for maximum flexibility&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function selectHelper($values, $match)&lt;br /&gt;{&lt;br /&gt;  $keys = array_keys($values);&lt;br /&gt;  $i = 0;&lt;br /&gt;	&lt;br /&gt;  foreach($values as $option)&lt;br /&gt;  {&lt;br /&gt;    $selected = null;&lt;br /&gt;		&lt;br /&gt;    if($match == $keys[$i])&lt;br /&gt;      $selected = " selected";&lt;br /&gt;			&lt;br /&gt;    echo "	&lt;option value=\"".$keys[$i]."\"$selected&gt;".$option."&lt;/option&gt;\n";&lt;br /&gt;		&lt;br /&gt;    $i++;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//sample usage:&lt;br /&gt;$values = array(&lt;br /&gt;  "lb" =&gt; "Pounds",&lt;br /&gt;  "ea" =&gt; "Each",&lt;br /&gt;  "oz" =&gt; "Ounces");&lt;br /&gt;				&lt;br /&gt;  selectHelper($values, $product-&gt;unit);&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 25 Jan 2008 02:13:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5035</guid>
      <author>nathancarnes (Nathan Carnes)</author>
    </item>
    <item>
      <title>Select DataBase Schema</title>
      <link>http://snippets.dzone.com/posts/show/4664</link>
      <description>// Select database schema.&lt;br /&gt;//This could be used to recreate or test for existence of columns/tables&lt;br /&gt;//or could also be used to create a database template system to enable the writing //of database schema into txt template file to be recreated again by reading the //txt file via an application&lt;br /&gt;//&lt;br /&gt;//You can also use SELECT * instead of defining each schema property (column)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;SELECT TABLE_CATALOG&lt;br /&gt;, TABLE_SCHEMA&lt;br /&gt;, TABLE_NAME&lt;br /&gt;, ORDINAL_POSITION&lt;br /&gt;, COLUMN_DEFAULT&lt;br /&gt;, IS_NULLABLE&lt;br /&gt;, DATA_TYPE&lt;br /&gt;, CHARACTER_MAXIMUM_LENGTH&lt;br /&gt;, COLLATION_NAME &lt;br /&gt;FROM &lt;br /&gt;INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = (N'Persons')&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 17 Oct 2007 11:30:21 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4664</guid>
      <author>dubby (Dave)</author>
    </item>
    <item>
      <title>SQL  -&gt; Check Column exists in table, if not, add</title>
      <link>http://snippets.dzone.com/posts/show/4663</link>
      <description>// Check to see if column exists and then create if not&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS&lt;br /&gt;WHERE TABLE_NAME = &#8216;TEST&#8217; AND COLUMN_NAME = &#8216;TEST_DATE&#8217;)&lt;br /&gt;BEGIN&lt;br /&gt;   ALTER TABLE TEST ADD TEST_DATE DATETIME&lt;br /&gt;END&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 17 Oct 2007 08:58:41 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4663</guid>
      <author>dubby (Dave)</author>
    </item>
    <item>
      <title>Use rails date_select without activerecord model</title>
      <link>http://snippets.dzone.com/posts/show/4630</link>
      <description>// In your view:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;%= date_select('range', 'start_date', :order =&gt; [:month, :day, :year])%&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// In your controller:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;@start_date = Date.civil(params[:range][:"start_date(1i)"].to_i,params[:range][:"start_date(2i)"].to_i,params[:range][:"start_date(3i)"].to_i)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Credit: http://www.jonsthoughtsoneverything.com/2006/05/21/how-to-access-date_select-without-an-active-record-model/</description>
      <pubDate>Wed, 10 Oct 2007 12:42:58 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4630</guid>
      <author>davenolan (davenolan)</author>
    </item>
    <item>
      <title>Fast selection</title>
      <link>http://snippets.dzone.com/posts/show/4622</link>
      <description>Selectv returns the position of the nth smallest number in the list.&lt;br /&gt;&lt;br /&gt;Selectv modifies the list.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;&lt;br /&gt;typedef struct {&lt;br /&gt;	int len;&lt;br /&gt;	int e[102];&lt;br /&gt;} List;&lt;br /&gt;&lt;br /&gt;void printv(char *msg, List l) {&lt;br /&gt;	printf("%s", msg);&lt;br /&gt;	int i;&lt;br /&gt;	for (i = 0; i &lt; l.len; ++i)&lt;br /&gt;		printf("%d ", l.e[i]);&lt;br /&gt;	printf("\n");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int pivot(List *l, int p, int r) {&lt;br /&gt;	int x = l-&gt;e[r];&lt;br /&gt;	int i = p - 1;&lt;br /&gt;	int j = r + 1;&lt;br /&gt;	&lt;br /&gt;	while (1) {&lt;br /&gt;		do {&lt;br /&gt;			++i;&lt;br /&gt;		} while (l-&gt;e[i] &lt; x);&lt;br /&gt;		do {&lt;br /&gt;			--j;&lt;br /&gt;		} while (l-&gt;e[j] &gt; x);&lt;br /&gt;	&lt;br /&gt;		//printf("%d %d\n", i, j);&lt;br /&gt;		&lt;br /&gt;		if (i &lt; j) {&lt;br /&gt;			int aux = l-&gt;e[i];&lt;br /&gt;			l-&gt;e[i] = l-&gt;e[j];&lt;br /&gt;			l-&gt;e[j] = aux;&lt;br /&gt;		} else&lt;br /&gt;			return i - 1;&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int selectv(List *l, int nrp, int p, int r) {&lt;br /&gt;	//printf("p, r: %d, %d\n", p, r);&lt;br /&gt;	//printf("nrp: %d\n", nrp);&lt;br /&gt;	//printv("l: ", *l);&lt;br /&gt;	&lt;br /&gt;	if (p == r)&lt;br /&gt;		return l-&gt;e[p];&lt;br /&gt;	&lt;br /&gt;	if (p &lt; r) {&lt;br /&gt;		int q = pivot(l, p, r);&lt;br /&gt;		&lt;br /&gt;		//getchar();&lt;br /&gt;		&lt;br /&gt;		if (q - p + 1&lt; nrp)&lt;br /&gt;			return selectv(l, nrp - (q - p) - 1, q + 1, r);&lt;br /&gt;		return selectv(l, nrp, p, q);&lt;br /&gt;	}&lt;br /&gt;	return -1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[]) {&lt;br /&gt;	List l;&lt;br /&gt;	l.len = 100;&lt;br /&gt;	int i;&lt;br /&gt;	for (i = 0; i &lt; l.len; ++i)&lt;br /&gt;		l.e[i] = l.len - i;&lt;br /&gt;	&lt;br /&gt;	int nth = 56;&lt;br /&gt;	printf("%d: %d\n", nth, selectv(&amp;l, nth, 0, l.len - 1));&lt;br /&gt;	&lt;br /&gt;	//printv("L: ", l);&lt;br /&gt;	&lt;br /&gt;	return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 08 Oct 2007 10:48:19 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4622</guid>
      <author>scvalex (Alexandru Scvortov)</author>
    </item>
    <item>
      <title>Selection //JavaScript Class</title>
      <link>http://snippets.dzone.com/posts/show/4620</link>
      <description>&lt;br /&gt;&lt;br /&gt;&lt;a href="http://jsfromhell.com/forms/selection"&gt;&lt;br /&gt;Retrieves and sets the cursor position, as well the selected text of inputs and textareas. After searching, I saw it's the only code which retrieves right information in textareas under Internet Explorer without damaging the "Ctrl+Z"&lt;br /&gt;&lt;br /&gt;[UPDATED CODE AND HELP CAN BE FOUND HERE]&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//+ Jonas Raoni Soares Silva&lt;br /&gt;//@ http://jsfromhell.com/forms/selection [v1.0]&lt;br /&gt;&lt;br /&gt;Selection = function(input){&lt;br /&gt;	this.isTA = (this.input = input).nodeName.toLowerCase() == "textarea";&lt;br /&gt;};&lt;br /&gt;with({o: Selection.prototype}){&lt;br /&gt;	o.setCaret = function(start, end){&lt;br /&gt;		var o = this.input;&lt;br /&gt;		if(Selection.isStandard)&lt;br /&gt;			o.setSelectionRange(start, end);&lt;br /&gt;		else if(Selection.isSupported){&lt;br /&gt;			var t = this.input.createTextRange();&lt;br /&gt;			end -= start + o.value.slice(start + 1, end).split("\n").length - 1;&lt;br /&gt;			start -= o.value.slice(0, start).split("\n").length - 1;&lt;br /&gt;			t.move("character", start), t.moveEnd("character", end), t.select();&lt;br /&gt;		}&lt;br /&gt;	};&lt;br /&gt;	o.getCaret = function(){&lt;br /&gt;		var o = this.input, d = document;&lt;br /&gt;		if(Selection.isStandard)&lt;br /&gt;			return {start: o.selectionStart, end: o.selectionEnd};&lt;br /&gt;		else if(Selection.isSupported){&lt;br /&gt;			var s = (this.input.focus(), d.selection.createRange()), r, start, end, value;&lt;br /&gt;			if(s.parentElement() != o)&lt;br /&gt;				return {start: 0, end: 0};&lt;br /&gt;			if(this.isTA ? (r = s.duplicate()).moveToElementText(o) : r = o.createTextRange(), !this.isTA)&lt;br /&gt;				return r.setEndPoint("EndToStart", s), {start: r.text.length, end: r.text.length + s.text.length};&lt;br /&gt;			for(var $ = "[###]"; (value = o.value).indexOf($) + 1; $ += $);&lt;br /&gt;			r.setEndPoint("StartToEnd", s), r.text = $ + r.text, end = o.value.indexOf($);&lt;br /&gt;			s.text = $, start = o.value.indexOf($);&lt;br /&gt;			if(d.execCommand &amp;&amp; d.queryCommandSupported("Undo"))&lt;br /&gt;				for(r = 3; --r; d.execCommand("Undo"));&lt;br /&gt;			return o.value = value, this.setCaret(start, end), {start: start, end: end};&lt;br /&gt;		}&lt;br /&gt;		return {start: 0, end: 0};&lt;br /&gt;	};&lt;br /&gt;	o.getText = function(){&lt;br /&gt;		var o = this.getCaret();&lt;br /&gt;		return this.input.value.slice(o.start, o.end);&lt;br /&gt;	};&lt;br /&gt;	o.setText = function(text){&lt;br /&gt;		var o = this.getCaret(), i = this.input, s = i.value;&lt;br /&gt;		i.value = s.slice(0, o.start) + text + s.slice(o.end);&lt;br /&gt;		this.setCaret(o.start += text.length, o.start);&lt;br /&gt;	};&lt;br /&gt;	new function(){&lt;br /&gt;		var d = document, o = d.createElement("input"), s = Selection;&lt;br /&gt;		s.isStandard = "selectionStart" in o;&lt;br /&gt;		s.isSupported = s.isStandard || (o = d.selection) &amp;&amp; !!o.createRange();&lt;br /&gt;	};&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Example&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;form id="form"&gt;&lt;br /&gt;	&lt;fieldset&gt;&lt;br /&gt;		&lt;legend&gt;Selection Test&lt;/legend&gt;&lt;br /&gt;		&lt;textarea name="text" rows="10" cols="30"&gt;&lt;br /&gt;www.jsfromhell.com&lt;br /&gt;Jonas Carlos Lalala&lt;br /&gt;Bin Laden x Bush&lt;br /&gt;		&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;		&lt;input name="getText" type="button" value="[Get selected text]" /&gt;&lt;br /&gt;		&lt;input name="getSel" type="button" value="[Get cursor]" /&gt;&lt;br /&gt;		&lt;br /&gt;&lt;input name="setText" type="button" value="[Set selected text]" /&gt;&lt;br /&gt;		&lt;input name="setSel" type="button" value="[Set cursor]" /&gt;&lt;br /&gt;	&lt;/fieldset&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;var f = document.forms.form;&lt;br /&gt;var selection = new Selection(f.text);&lt;br /&gt;&lt;br /&gt;f.getText.onclick = function(){&lt;br /&gt;	alert(selection.getText());&lt;br /&gt;	f.text.focus();&lt;br /&gt;};&lt;br /&gt;f.setText.onclick = function(){&lt;br /&gt;	var s = prompt("New text:", selection.getText());&lt;br /&gt;	s !== null &amp;&amp; selection.setText(s);&lt;br /&gt;	f.text.focus();&lt;br /&gt;};&lt;br /&gt;f.getSel.onclick = function(){&lt;br /&gt;	var s = selection.getCaret();&lt;br /&gt;	alert("Start: " + s.start + "\nEnd: " + s.end);&lt;br /&gt;	f.text.focus();&lt;br /&gt;};&lt;br /&gt;f.setSel.onclick = function(){&lt;br /&gt;	var s = selection.getCaret();&lt;br /&gt;	selection.setCaret(+prompt("Start:", s.start) || 0, +prompt("End:", s.end) || 0);&lt;br /&gt;	f.text.focus();&lt;br /&gt;};&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 06 Oct 2007 15:02:21 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4620</guid>
      <author>jonasraoni (Jonas Raoni Soares Silva)</author>
    </item>
    <item>
      <title>PHP: Create a SELECT input field</title>
      <link>http://snippets.dzone.com/posts/show/4555</link>
      <description>Creates a SELECT input field with an optional parameter to preselect an item&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function selectfield($optionsarray, $selected = "") {&lt;br /&gt;  $returnval = "";&lt;br /&gt;  foreach ($optionsarray as $field=&gt;$value) {&lt;br /&gt;    if ($field == $selected) {&lt;br /&gt;      $returnval .= "&lt;option selected value='" . $field . "'&gt;" . $value . "&lt;/option&gt;\n";&lt;br /&gt;    } else {&lt;br /&gt;      $returnval .= "&lt;option value='" . $field . "'&gt;" . $value . "&lt;/option&gt;\n";&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  return $returnval;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 19 Sep 2007 08:46:29 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4555</guid>
      <author>cornerblue (CornerBLUE, Inc.)</author>
    </item>
    <item>
      <title>MSSQL 2005 - Add ID value to ID column when INSERTING </title>
      <link>http://snippets.dzone.com/posts/show/4521</link>
      <description>// @TableName is obviously the TABLE name u use&lt;br /&gt;// @ColumnName is obviously the COLUMN name u use&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;---Get next ID number&lt;br /&gt;	DECLARE &lt;br /&gt;		@ID int&lt;br /&gt;	&lt;br /&gt;	IF (SELECT count(*) FROM @TableName ) &gt; 0&lt;br /&gt;		BEGIN&lt;br /&gt;			SELECT @ID  = max(ColumnName ) from @TableName&lt;br /&gt;			SET @ID = @ID + 1 &lt;br /&gt;		END&lt;br /&gt;	ELSE&lt;br /&gt;	BEGIN&lt;br /&gt;		SET @ID  = 1&lt;br /&gt;	END&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 11 Sep 2007 07:50:29 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4521</guid>
      <author>dubby (Dave)</author>
    </item>
    <item>
      <title>HTML/JavaScript - Select list - Add/Remove Options (DOM)</title>
      <link>http://snippets.dzone.com/posts/show/4442</link>
      <description>from http://www.mredkj.com/tutorials/tutorial005.html&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Overview&lt;br /&gt;&lt;br /&gt;    * Insert Before Selected - A new option is created and added above the selected option (as determined by selectedIndex). If none are selected, then no option is added.&lt;br /&gt;    * Remove Selected - Deletes the selected option (or options) from the list. If no options are selected, no options are deleted.&lt;br /&gt;    * Append Last - No matter what is selected, a new option is added at the end.&lt;br /&gt;    * Remove Last - No matter what is selected, the last option is deleted from the list.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Explanation&lt;br /&gt;&lt;br /&gt;According to DOM Level 1, the following is the syntax for the add and remove methods in HTMLSelectElement:&lt;br /&gt;&lt;br /&gt;void add(in HTMLElement element, in HTMLElement before) raises(DOMException);&lt;br /&gt;void remove(in long index);&lt;br /&gt;&lt;br /&gt;The add method takes two arguments: the element to add, and the element to insert before. The spec also says you can add to the end of the list by passing null as the second argument.&lt;br /&gt;&lt;br /&gt;The remove method just takes a number: the index of the option to be removed. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The JavaScript&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;script language="JavaScript" type="text/javascript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;var count1 = 0;&lt;br /&gt;var count2 = 0;&lt;br /&gt;&lt;br /&gt;function insertOptionBefore(num)&lt;br /&gt;{&lt;br /&gt;  var elSel = document.getElementById('selectX');&lt;br /&gt;  if (elSel.selectedIndex &gt;= 0) {&lt;br /&gt;    var elOptNew = document.createElement('option');&lt;br /&gt;    elOptNew.text = 'Insert' + num;&lt;br /&gt;    elOptNew.value = 'insert' + num;&lt;br /&gt;    var elOptOld = elSel.options[elSel.selectedIndex];  &lt;br /&gt;    try {&lt;br /&gt;      elSel.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE&lt;br /&gt;    }&lt;br /&gt;    catch(ex) {&lt;br /&gt;      elSel.add(elOptNew, elSel.selectedIndex); // IE only&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function removeOptionSelected()&lt;br /&gt;{&lt;br /&gt;  var elSel = document.getElementById('selectX');&lt;br /&gt;  var i;&lt;br /&gt;  for (i = elSel.length - 1; i&gt;=0; i--) {&lt;br /&gt;    if (elSel.options[i].selected) {&lt;br /&gt;      elSel.remove(i);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function appendOptionLast(num)&lt;br /&gt;{&lt;br /&gt;  var elOptNew = document.createElement('option');&lt;br /&gt;  elOptNew.text = 'Append' + num;&lt;br /&gt;  elOptNew.value = 'append' + num;&lt;br /&gt;  var elSel = document.getElementById('selectX');&lt;br /&gt;&lt;br /&gt;  try {&lt;br /&gt;    elSel.add(elOptNew, null); // standards compliant; doesn't work in IE&lt;br /&gt;  }&lt;br /&gt;  catch(ex) {&lt;br /&gt;    elSel.add(elOptNew); // IE only&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function removeOptionLast()&lt;br /&gt;{&lt;br /&gt;  var elSel = document.getElementById('selectX');&lt;br /&gt;  if (elSel.length &gt; 0)&lt;br /&gt;  {&lt;br /&gt;    elSel.remove(elSel.length - 1);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The HTML&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;form&gt;&lt;br /&gt;&lt;input type="button" value="o" onclick="insertOptionBefore(count1++);" /&gt;&lt;br /&gt;Insert Before Selected&lt;br /&gt;&lt;br /&gt;&lt;input type="button" value="o" onclick="removeOptionSelected();" /&gt;&lt;br /&gt;Remove Selected&lt;br /&gt;&lt;br /&gt;&lt;select id="selectX" size="10" multiple="multiple"&gt;&lt;br /&gt;&lt;option value="original1" selected="selected"&gt;Orig1&lt;/option&gt;&lt;br /&gt;&lt;option value="original2"&gt;Orig2&lt;/option&gt;&lt;br /&gt;&lt;/select&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;input type="button" value="o" onclick="appendOptionLast(count2++);" /&gt;&lt;br /&gt;Append Last&lt;br /&gt;&lt;br /&gt;&lt;input type="button" value="o" onclick="removeOptionLast();" /&gt;&lt;br /&gt;Remove Last&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Wed, 22 Aug 2007 12:39:41 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4442</guid>
      <author>bradalyst (brad)</author>
    </item>
  </channel>
</rss>
