<?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>Cai Feng's Blog &#187; javascript</title>
	<atom:link href="http://blog.caifeng.me/category/development/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.caifeng.me</link>
	<description>Paw trace ...</description>
	<lastBuildDate>Tue, 19 Oct 2010 16:53:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Array&#8217;s last comma affect it&#8217;s length in IE</title>
		<link>http://blog.caifeng.me/2010/10/20/arrays-last-comma-affect-its-length-in-ie/</link>
		<comments>http://blog.caifeng.me/2010/10/20/arrays-last-comma-affect-its-length-in-ie/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 16:53:31 +0000</pubDate>
		<dc:creator>ljpsfree</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.caifeng.me/?p=90</guid>
		<description><![CDATA[
  var arr = &#91;1, 2, 3,&#93;;
  alert&#40;arr.length&#41;;

In firefox, the result is 3, but in IE, it is 4. It always takes some bugs which are hard to found. Right now, I don&#8217;t know which is the correct way, but I always remove the last comma safely.
]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  <span style="color: #003366; font-weight: bold;">var</span> arr <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">,</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>arr.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In firefox, the result is 3, but in IE, it is 4. It always takes some bugs which are hard to found. Right now, I don&#8217;t know which is the correct way, but I always remove the last comma safely.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.caifeng.me/2010/10/20/arrays-last-comma-affect-its-length-in-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use google form as a simple survey system</title>
		<link>http://blog.caifeng.me/2009/07/20/how-to-use-google-form-as-a-simple-survey-system/</link>
		<comments>http://blog.caifeng.me/2009/07/20/how-to-use-google-form-as-a-simple-survey-system/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 06:35:22 +0000</pubDate>
		<dc:creator>ljpsfree</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.caifeng.me/blog/?p=67</guid>
		<description><![CDATA[Preview

A google form is a simple generally form system. You can use it to generate a form to ask your user some questions and collect the answers into a google spreadsheet automatically. And then you can do farther data analytics with that spreadsheet.
Actually, the google form can be used directly. But in some cases, the [...]]]></description>
			<content:encoded><![CDATA[<h4 id="Preview">Preview</h4>
<ul>
<li>A google form is a simple generally form system. You can use it to generate a form to ask your user some questions and collect the answers into a google spreadsheet automatically. And then you can do farther data analytics with that spreadsheet.</li>
<li>Actually, the google form can be used directly. But in some cases, the user want to change the google form&#8217;s default behavior to meet their requirements, such as they don&#8217;t want it to be redirected to google&#8217;s response page which have google&#8217;s logo there, they want to customize the design of the google form, etc</li>
<li>This scripts is used to focus on these special cases, also it can&#8217;t cover all of these cases, but it&#8217;s a beginning.</li>
</ul>
<h4>Design</h4>
<ul>
<li>I used a iframe to handle the google form&#8217;s default response.</li>

<div class="wp_syntax"><div class="code"><pre class="htm" style="font-family:monospace;">  &lt;form target=&quot;gsurvey_result&quot;&gt;&lt;/form&gt;
  &lt;iframe name=&quot;gsurvey_result&quot; height=&quot;1&quot; style=&quot;display:none;&quot;&gt;&lt;/iframe&gt;</pre></div></div>

<li>I used javascript to replace all of the radio button with a image, when the user clicks the image, the value of the radio will be synced directly. The image can be changed with css.</li>
<li>I used the javascript to check if the required field has a value. But now there&#8217;s nothing to do with the required field without a value.</li>
<li>User can define the response text by themselves.</li>
</ul>
<h4 id="Anexample">An example</h4>
<ul>
<li>Generate a google form with your own google account.</li>
<li>Create a new html file, load the script gsurvey.js, gsurvey.css in the html file.</li>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
  &lt;link rel=&quot;stylesheet&quot; media=&quot;screen&quot; href=&quot;/static/css/gsurvey.css&quot; /&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;/static/js/jquery.gsurvey.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<li>Insert the html code of the google form. You can also define a element holds response text. You can check the code in the attachments.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.caifeng.me/2009/07/20/how-to-use-google-form-as-a-simple-survey-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

