 




<?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>IT Answers &#187; JavaScript addContent function</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/tag/javascript-addcontent-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers</link>
	<description></description>
	<lastBuildDate>Sat, 18 May 2013 00:58:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>JavaScript addContent function &#8211; Packaging Options</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/addcontent-packaging-options/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/addcontent-packaging-options/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 23:44:43 +0000</pubDate>
		<dc:creator>Bryanfox</dc:creator>
				<category><![CDATA[addContent]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScript addContent function]]></category>
		<category><![CDATA[JavaScript forms]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[* IS THERE A WAY to use this javascript addContent function, * Incorporate the utility of an ADD button * But avoid using the packaging of FORMS? While making use of a sample for addContent (located at http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/, I stumbled into a problem that I hope someone can help on. We have a PHP/MySQL page [...]]]></description>
				<content:encoded><![CDATA[<p>* IS THERE A WAY to use this javascript addContent function,<br />
* Incorporate the utility of an ADD button<br />
* But avoid using the packaging of FORMS? </p>
<p>While making use of a sample for addContent (located at http://www.randomsnippets.com/2008/04/14/how-to-dynamically-add-content-to-a-div-via-javascript/, I stumbled into a problem that I hope someone can help on.  </p>
<p>We have a PHP/MySQL page that has to be modified to ADD rows for data entry when needed.  I have abandoned the traditional DOM object methods of adding a single row, since in this case the addition would be a whole block of rows.  I don&#8217;t think I&#8217;m smart enough to do that&#8230;  </p>
<p>Anyway, an idea hit me to make use of our MySQL dB and store the rows in there, and retrieve them using their method.  </p>
<p>&lt;script language=&#8221;javascript&#8221;&gt;<br />
function addContent(divName, content) {<br />
     document.getElementById(divName).innerHTML = content;<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;form name=&#8221;myForm&#8221;&gt;</p>
<p>Content to be added:<br />
&lt;textarea name=&#8221;myContent&#8221;&gt;&lt;?php echo $_value ?&gt;&lt;/textarea&gt;<br />
&lt;input type=&#8221;button&#8221; value=&#8221;Add content&#8221; onClick=&#8221;addContent(&#8216;myDiv&#8217;, document.myForm.myContent.value); setCookie(&#8216;content&#8217;, document.myForm.myContent.value, 7);&#8221;&gt;</p>
<p>&lt;/form&gt;</p>
<p>&lt;br&gt;&lt;br&gt;<br />
Your content will be added dynamically below:<br />
&lt;div id=&#8221;myDiv&#8221;&gt;&lt;/div&gt;</p>
<p>Skipping an ultimate requirement that the content of the addition be invisible and inaccessible, I tried the above out.  It works, but the variable ($_value) has form elements in it, including &lt;TEXTAREA&gt;&lt;/TEXTAREA&gt;.   The close of the tag, interrupts the value and throws the remaining code to the page, not awaiting insertion by the Submit Button.  Example:  [url]http://www.facey.com/insert_content1.php[/url]</p>
<p>The Submit button successfully produces the part that stayed inside, but you see my problem.</p>
<p>IS THERE A WAY to use this javascript addContent function,<br />
     incorporate the utility of an ADD button<br />
           but avoid using the packaging of FORMS? </p>
<p>Thanks for any help!</p>
<p>Bryan<br />
[EMAIL="bfox@facey.com">bfox@facey.com[/EMAIL]</p>
<p>p.s.  The PHP is transparent.  Direct inclusion of the HTML contained in the variable as the value of TEXTAREA produces the same result.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/addcontent-packaging-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/14 queries in 0.016 seconds using memcached
Object Caching 328/345 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-18 10:32:40 -->