<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: dom code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 27 Jul 2008 03:54:13 GMT</pubDate>
    <description>DZone Snippets: dom code</description>
    <item>
      <title>Firefox 3 and input file</title>
      <link>http://snippets.dzone.com/posts/show/5760</link>
      <description>The nsIDOMFile interface retrieves data from a file submitted to a form using the input type "file". This allows the file reference to be saved when the form is submitted while the user is using a web application offline, so that the data can be retrieved and uploaded once the Internet connection is restored.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;	&lt;title&gt;input type=file &amp; Firefox 3&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;	&lt;br /&gt;&lt;h1&gt;input type=file &amp; Firefox 3&lt;/h1&gt;&lt;br /&gt;	&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;// &lt;![CDATA[&lt;br /&gt;&lt;br /&gt;function inputFileOnChange() {&lt;br /&gt;	var v_console = '';&lt;br /&gt;	v_console += 'value: ' + document.getElementById('my-file').value;&lt;br /&gt;	v_console += '&lt;br \/&gt;';&lt;br /&gt;	&lt;br /&gt;	if(document.getElementById('my-file').files) {&lt;br /&gt;		// Support: nsIDOMFile, nsIDOMFileList&lt;br /&gt;		v_console += 'files.length: ' + document.getElementById('my-file').files.length;&lt;br /&gt;		v_console += '&lt;br \/&gt;';&lt;br /&gt;		&lt;br /&gt;		v_console += 'fileName: ' + document.getElementById('my-file').files.item(0).fileName;&lt;br /&gt;		v_console += '&lt;br \/&gt;';&lt;br /&gt;		&lt;br /&gt;		v_console += 'fileSize: ' + document.getElementById('my-file').files.item(0).fileSize;&lt;br /&gt;		v_console += '&lt;br \/&gt;';&lt;br /&gt;		&lt;br /&gt;		v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsDataURL();&lt;br /&gt;//		v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsBinary();&lt;br /&gt;//		v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsText();&lt;br /&gt;		v_console += '&lt;br \/&gt;';&lt;br /&gt;	};&lt;br /&gt;	&lt;br /&gt;	document.getElementById('console').innerHTML = v_console;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// ]]&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;	&lt;br /&gt;&lt;div&gt;&lt;br /&gt;	&lt;input type="file" name="my-file" id="my-file" onchange="inputFileOnChange();" /&gt;&lt;br /&gt;	&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	&lt;code id="console"&gt;...console...&lt; /code&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/plan-de-site/"&gt;Source: &lt;/a&gt;&lt;a href="http://www.ab-d.fr/date/2008-07-12/"&gt;Firefox 3 and input type=file , upload file&lt;/a&gt;</description>
      <pubDate>Sat, 12 Jul 2008 10:51:15 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5760</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>insertAfter() with insertBefore() and node.nextSibling</title>
      <link>http://snippets.dzone.com/posts/show/5179</link>
      <description>insertAfter() with insertBefore() and node.nextSibling&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Node.prototype.insertAfter = function(newNode, refNode) {&lt;br /&gt;	if(refNode.nextSibling) {&lt;br /&gt;		return this.insertBefore(newNode, refNode.nextSibling);&lt;br /&gt;	} else {&lt;br /&gt;		return this.appendChild(newNode);&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: Benoit Asselin&lt;/a&gt;</description>
      <pubDate>Tue, 26 Feb 2008 20:53:30 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5179</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Include CSS Stylesheet by DOM</title>
      <link>http://snippets.dzone.com/posts/show/4554</link>
      <description>&lt;code&gt;&lt;br /&gt;&lt;br /&gt;function includeCSS(p_file) {&lt;br /&gt;	var v_css  = document.createElement('link');&lt;br /&gt;	v_css.rel = 'stylesheet'&lt;br /&gt;	v_css.type = 'text/css';&lt;br /&gt;	v_css.href = p_file;&lt;br /&gt;	document.getElementsByTagName('head')[0].appendChild(v_css);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: Document Object Model (DOM) Level 1 Specification&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Tue, 18 Sep 2007 19:46:39 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4554</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
  </channel>
</rss>
