<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: Mstram's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 05 Sep 2008 17:28:48 GMT</pubDate>
    <description>DZone Snippets: Mstram's Code Snippets</description>
    <item>
      <title>Condensed "Send html Select Value to Textarea"</title>
      <link>http://snippets.dzone.com/posts/show/4466</link>
      <description>// &lt;br /&gt;// When the &lt;select&gt; is changed it should send the current select.value&lt;br /&gt;// to a given texarea (id='content' in this case)&lt;br /&gt;&lt;br /&gt;// The user can also just type directly into the textarea, the idea being that&lt;br /&gt;// the &lt;select&gt; gives access to a stored list of words. Actually the practical&lt;br /&gt;// use I'm trying to make of it is to hook it into the 'Instiki'  R.O.R. wiki&lt;br /&gt;&lt;br /&gt;//&lt;br /&gt;// With FireFox 2.0.04, this is working UNTIL something is manually typed into&lt;br /&gt;// the text area, then it stops working.&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;// It DOES work with IE6.&lt;br /&gt;&lt;br /&gt;//&lt;br /&gt;// It doesn't work with Opera 9.0.2&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function SendSelectValueToTextArea(selectValue,targetTextArea)&lt;br /&gt;{&lt;br /&gt;   var txtNode=document.createTextNode(selectValue);&lt;br /&gt;   var textArea=document.getElementById(targetTextArea);&lt;br /&gt;   textArea.appendChild(txtNode);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;select  onchange="SendSelectValueToTextArea(this.value,'content')" &gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 25 Aug 2007 00:58:31 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4466</guid>
      <author>mstram (Mike Stramba)</author>
    </item>
    <item>
      <title>JavaScript Fill Textarea from HTML Select not working with FireFox or Opera but does in IE6</title>
      <link>http://snippets.dzone.com/posts/show/4465</link>
      <description>//&lt;br /&gt;//  Fill textarea with keywords from HTML Select element&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;This code DOES work in I.E6 (on my machine (XP pro), but doesn't work in Firefox 2.0.0.4 or Opera 9.0.2&lt;br /&gt;&lt;br /&gt;The idea is to be able to either type in the text area directly or choose from a list of saved words in the select box. When a new choice is made from the select, it automatically gets inserted into the text area.&lt;br /&gt;&lt;br /&gt;With Firefox , when the page is first loaded, I can choose from the select control and it works until I type something in the text area, and then it stops working.&lt;br /&gt;&lt;br /&gt;With Opera 9.02, the select control doesn't work at all.&lt;br /&gt;&lt;br /&gt;IE6, works fine.&lt;br /&gt;&lt;br /&gt;Any hints tips, appreciated, as I'm a novice with javascript / DOM programming.&lt;br /&gt;&lt;br /&gt;I quite possibly am not using the most correct / efficient document.XXX calls here.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Mike&lt;br /&gt;&lt;br /&gt;You can test it at http://mstramba.com/fb5.html&lt;br /&gt;&lt;br /&gt;///////////////&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;&lt;br /&gt;  &lt;style type="text/css"&gt;textarea {  height:200px; width:50%;}&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;&lt;br /&gt;function htmlData(selectValue,targetTextArea)&lt;br /&gt;{&lt;br /&gt;//   alert("select box changed to : '" + selectValue + "'");&lt;br /&gt;&lt;br /&gt;   var txtNode=document.createTextNode(selectValue);&lt;br /&gt;   var textArea=document.getElementById(targetTextArea);&lt;br /&gt;   textArea.appendChild(txtNode);&lt;br /&gt;}&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt; &lt;form method="post"&gt;&lt;br /&gt; &lt;select name="country" id="selbox" onchange="htmlData(this.value,'content')" /&gt;&lt;br /&gt;   &lt;option value="#"&gt;-Select-&lt;/option&gt;&lt;br /&gt;   &lt;option value="SuperCaliFragilisticExpiAliDocius"&gt;SuperCaliFragilisticExpiAliDocius&lt;/option&gt;&lt;br /&gt;   &lt;option value="Discombombulatively"&gt;Discombombulatively&lt;/option&gt;&lt;br /&gt;   &lt;option value="I don't understand how this can be happening"&gt;I don't understand how this can be happening&lt;/option&gt;&lt;br /&gt; &lt;/select&gt;&lt;br /&gt;&lt;br /&gt; &lt;textarea name="content" id="content"&gt;Type some text or choose words from the select control&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt; &lt;input type="submit" /&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 24 Aug 2007 23:38:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4465</guid>
      <author>mstram (Mike Stramba)</author>
    </item>
    <item>
      <title>Ruby - "meta method" execute</title>
      <link>http://snippets.dzone.com/posts/show/4452</link>
      <description>//&lt;br /&gt;//&lt;br /&gt;// attempt to execute a method indirectly, I don't know if&lt;br /&gt;// it's possible, but I suspect it is, and probably just&lt;br /&gt;// have the syntax wrong&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ar = %w(apples bananas oranges)&lt;br /&gt;&lt;br /&gt;print "\n ar.class = #{ar.class}"&lt;br /&gt;&lt;br /&gt;print "\n ar.methods = #{ar.methods.sort}"&lt;br /&gt;puts "======================================================="&lt;br /&gt;&lt;br /&gt;mets = ar.methods.sort&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# this doesn't work ... is there a syntax for doing this?&lt;br /&gt;#                       i.e. calling a 'meta' method ?&lt;br /&gt;#&lt;br /&gt;# call each method of 'ar' (an array)&lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;mets.each {|method| ar.method} &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 23 Aug 2007 19:19:12 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4452</guid>
      <author>mstram (Mike Stramba)</author>
    </item>
  </channel>
</rss>
