<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://www.bytemycode.com/rssformat.xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>byteMyCode: Snippets for kiss</title>
		<link>http://www.bytemycode.com</link>
		<description>Snippets for this tag.</description>
		<pubDate>Tue, 02 Dec 2008 01:35:23 +0000</pubDate>
		<copyright>1998-2008 </copyright>
		<language>en-us</language>
		<image>
		      <link>http://www.bytemycode.com</link>
		      <url>http://www.bytemycode.com/img/rss_title.gif</url>
		      <title>byteMyCode</title>
		</image>

	<item>
	<title>Auto Create New Element</title>
	<link>http://www.bytemycode.com/snippets/snippet/665/</link>
	<comments>http://www.bytemycode.com/snippets/snippet/665/comments/</comments>
	<pubDate>Mon, 04 Jun 2007 14:37:44 +0000</pubDate>
	<dc:creator>Fordiman</dc:creator>
	<category>createElement, JavaScript, kiss</category>
	<guid isPermaLink="false">http://www.bytemycode.com/snippets/snippet/665/</guid>
	<description>
		<![CDATA[

			<img src="http://www.bytemycode.com/img/icon_calendar.gif" align="middle" class="icon" alt="Date Submitted" /> Mon. Jun. 4th, 2007  2:37 PM			<br />
			<img src="http://www.bytemycode.com/img/icon_revision.gif" align="middle" class="icon" alt="Revision" /> <a href="http://www.bytemycode.com/snippets/snippet/665/revisions/">1</a>
			<br />
			<img src="http://www.bytemycode.com/img/rank_scripter.gif" align="middle" class="icon" alt="Scripter" /> <a href="http://www.bytemycode.com/members/member/Fordiman/" title="Scripter">Fordiman</a>
			<br />
			<img src="http://www.bytemycode.com/img/icon_tag.gif" align="middle" class="icon" alt="Tags" /> <a href="http://www.bytemycode.com/tags/tag/createElement">createElement</a>&nbsp;|&nbsp;<a href="http://www.bytemycode.com/tags/tag/JavaScript">JavaScript</a>&nbsp;|&nbsp;<a href="http://www.bytemycode.com/tags/tag/kiss">kiss</a>			<br />
			<img src="http://www.bytemycode.com/img/icon_comments.gif" align="middle" class="icon" alt="Comments" /> <a href="http://www.bytemycode.com/snippets/snippet/665/comments/">1 comments</a>
			<br />
			<img src="http://www.bytemycode.com/img/icon_ranking.gif" align="middle" class="icon" alt="Ranking" /> 10
			<p>This is a function I created to ease headaches caused by creating and inserting new stuff in an HTML document dynamically.  Essentially, it allows you to specify an HTML tag, in its entirety (attributes, styles, event handling, etc), via a single command.  You can nest it, so as to create an entire element tree programmatically in a lot less time as with document.createElement.<br /><br />Don't let the goofy function acronym fool you; this is damned powerful.<br /><br />First, the function spec:<br />HTMLElement acne(<i>type</i>[,<i>attributes</i>[,<i>styles</i>[,<i>events</i>[,<i>children</i>[,<i>parent</i>[,<i>document</i>]]]]]]);<br /><br />Arguments:<br /><blockquote>String <i>type</i>: type of element to create; same information as the argument of document.createElement<br />mixed Object <i>attributes</i>: attributes you want the new element to have (ie: href, src)<br />mixed Object <i>styles</i>: styles for the new element (ie: width, borderLeft)<br />(function|function Array) Object <i>events</i>: event handlers for the new element<br />HTMLElement|HTMLElement Array <i>children</i>: elements you want to be in the new element (ie: nesting is possible)<br />HTMLElement <i>parent</i>: parent node of object<br />HTMLDocument <i>document</i>: document to create element in<br /></blockquote><br />Return value: The newly created/configured element</p>
		]]>
	</description>
</item>
	</channel>
</rss>