<?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>The Error Message &#187; HTML</title>
	<atom:link href="http://www.theerrormessage.com/category/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.theerrormessage.com</link>
	<description>Fix your error</description>
	<lastBuildDate>Sun, 18 Jul 2010 03:21:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>base html tag does not apply correctly to all javascript and style files</title>
		<link>http://www.theerrormessage.com/2009/07/base-html-tag-does-not-apply-correctly-to-all-javascript-and-style-files/</link>
		<comments>http://www.theerrormessage.com/2009/07/base-html-tag-does-not-apply-correctly-to-all-javascript-and-style-files/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 15:21:40 +0000</pubDate>
		<dc:creator>gbl</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.theerrormessage.com/2009/07/03/base-html-tag-does-not-apply-correctly-to-all-javascript-and-style-files/</guid>
		<description><![CDATA[Problem: The &#60;base href="http://example.com/path/to/res/"&#62;  did not work at all on Internet Explorer &#8211; no javascript or style files were loaded and worked partially in Mozilla Firefox &#8211; a few javascript files were not pointing to the path that should be transformed by base href attribute. Example: Array( [0] =&#62; 1 ) &#60;!DOCTYPE html PUBLIC "-//W3C//DTD [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong>: The <code class="html">&lt;base href="http://example.com/path/to/res/"&gt;</code>  did not work at all on Internet Explorer &#8211; no javascript or style files were loaded and worked partially in Mozilla Firefox &#8211; a few javascript files were not pointing to the path that should be transformed by base href attribute.</p>
<p>Example:<br />
<code class="html"><br />
Array(<br />
[0] =&gt; 1<br />
)<br />
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;<br />
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;<br />
&lt;base href="http://example.com/path/to/res/"&gt;<br />
&lt;link rel="stylesheet" href="./css/styles.css" type="text/css" /&gt;<br />
&lt;scrupt src="./js/jquery.js" type="text/javascript"&gt;&lt;/script&gt;<br />
&lt;scrupt src="./js/j1.js" type="text/javascript"&gt;&lt;/script&gt;<br />
&lt;scrupt src="./js/j2.js" type="text/javascript"&gt;&lt;/script&gt;<br />
</code><br />
This code produced a page with no style files and  no javascript files included in Interenet Explorer 8 and a few javascript files (j1.js and j2.js) were not included in Firefox 3.5 because base tag was not applied. After several tests and all kind of different arrangements we discovered that the problem was the output before the page source the <code>Array ...</code> thing.</p>
<p><strong>Solution</strong>: no output before the page&#8217;s headers otherwise you can get all kind of strange results including a html base tag not working correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theerrormessage.com/2009/07/base-html-tag-does-not-apply-correctly-to-all-javascript-and-style-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem: When submitting a form, seems like another form gets submitted</title>
		<link>http://www.theerrormessage.com/2007/12/problem-when-submitting-a-form-seems-like-another-form-gets-submitted/</link>
		<comments>http://www.theerrormessage.com/2007/12/problem-when-submitting-a-form-seems-like-another-form-gets-submitted/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 15:29:16 +0000</pubDate>
		<dc:creator>thalissar</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.theerrormessage.com/2007/12/10/problem-when-submitting-a-form-seems-like-another-form-gets-submitted/</guid>
		<description><![CDATA[Actually, I had two forms on the same page, one with the GET method (let&#8217;s call it get_form), the other with the POST method (we&#8217;ll call it post_form). When I pressed the submit button of get_form it seemed that the post_form got submitted. In fact, all the variables in get_form and post_form were passed with [...]]]></description>
			<content:encoded><![CDATA[<p>Actually, I had two forms on the same page, one with the GET method (let&#8217;s call it <em>get_form</em>), the other with the POST method (we&#8217;ll call it <em>post_form</em>). When I pressed the submit button of <em>get_form</em> it seemed that the <em>post_form</em> got submitted. In fact, all the variables in <em>get_form</em> and <em>post_form</em> were passed with the POST method.</p>
<p>So the natural thing that came into my mind was that the two forms were intersecting. But how? I knew for sure they were separate forms because <em>get_form</em> was in a file that I was including in the file that contained <em>post_form</em>, after <em>post_form</em>.</p>
<p>After verifying the HTML source over and over again I finally solved the mistery. There was a stupid mistake I made: I did not close <em>post_form</em> properly. Instead of using the form closing tag <em>&lt;/form&gt;</em> at the end of <em>post_form</em>, i put the form opening tag <em>&lt;form&gt;</em> and every time I checked for the problem, I missed an important detail: the lack of the slash sign.</p>
<p>Conclusion: When opening a HTML element, make sure to close it accordingly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theerrormessage.com/2007/12/problem-when-submitting-a-form-seems-like-another-form-gets-submitted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to check/uncheck a bunch of checkboxes without using ids for the checkbox inputs</title>
		<link>http://www.theerrormessage.com/2007/12/how-to-selectdeselect-a-bunch-of-checkboxes-without-using-ids-for-the-checkbox-inputs/</link>
		<comments>http://www.theerrormessage.com/2007/12/how-to-selectdeselect-a-bunch-of-checkboxes-without-using-ids-for-the-checkbox-inputs/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 18:21:04 +0000</pubDate>
		<dc:creator>thalissar</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.theerrormessage.com/2007/12/09/how-to-selectdeselect-a-bunch-of-checkboxes-without-using-ids-for-the-checkbox-inputs/</guid>
		<description><![CDATA[My solution of checking/unchecking a group of HTML checkboxes using Javascript implies using an array of checkboxes, which means naming all the inputs of type &#8216;checkbox&#8217; like array_name[]. Example: &#60;form name="cb_form"&#62; &#60;input type="checkbox" name="cb[]" value="0" /&#62;Zero &#60;input type="checkbox" name="cb[]" value="1" /&#62;One &#60;input type="checkbox" name="cb[]" value="2" /&#62;Two &#60;input type="checkbox" name="cb[]" value="3" /&#62;Three &#60;/form&#62; In this example, [...]]]></description>
			<content:encoded><![CDATA[<p>My solution of checking/unchecking a group of HTML checkboxes using Javascript implies using an array of checkboxes, which means naming all the inputs of type &#8216;checkbox&#8217; like <em>array_name[]</em>. Example:</p>
<p><code class="html">&lt;form name="cb_form"&gt;<br />
&lt;input type="checkbox" name="cb[]" value="0" /&gt;Zero<br />
&lt;input type="checkbox" name="cb[]" value="1" /&gt;One<br />
&lt;input type="checkbox" name="cb[]" value="2" /&gt;Two<br />
&lt;input type="checkbox" name="cb[]" value="3" /&gt;Three<br />
&lt;/form&gt;</code></p>
<p>In this example, the name of the checkboxes array is <em>cb</em>.</p>
<p>Next, we place two links for checking/unchecking all checkboxes in our array. If someone clicks one of these links, the <em>check</em><em>All()</em> JavaScript function is called:</p>
<p><code class="html">&lt;a href="" onclick="checkAll('cb_form', 'cb[]', true); return false;"&gt;Check all&lt;a&gt;<br />
&lt;a href="" onclick="checkAll('cb_form', 'cb[]', false); return false;"&gt;Uncheck all&lt;a&gt;</code></p>
<p>The checking/unchecking all checkboxes function in JavaScipt looks like this:</p>
<p><code class="javascript">function checkAll(form_name, cb_name, value)<br />
{<br />
var cb_arr = document.forms[form_name].elements[cb_name];<br />
// if the checkboxes exist<br />
if(cb_arr)<br />
{<br />
// if the number of checkboxes is at least 2<br />
if(cb_arr.length &gt; 1)<br />
{<br />
// for each checkbox<br />
for(i = 0; i &lt; cb_arr.length; i++)<br />
{<br />
// check (value == true) or uncheck (value == false) it<br />
cb_arr[i].checked = value;<br />
}<br />
}<br />
else // cb_arr.length is undefined which means there is a single checkbox element that is not considered an array of one element<br />
{<br />
cb_arr.checked = value;<br />
}<br />
}<br />
}<br />
</code><br />
Note that if we only have one checkbox, the variable <em>cb</em> it is not considered an array, but a normal variable. This is useful in the situation of dinamically generated HTML pages (using PHP, for example) and the number of checkboxes varies from page to page.</p>
<p>You can test the example here:</p>
<p><script type="text/javascript"> function selectAll(form_name, cb_name, value) { var cb_arr = document.forms[form_name].elements[cb_name]; if(cb_arr) { if(cb_arr.length > 1) { for(i = 0; i < cb_arr.length; i++) { cb_arr[i].checked = value; } } else if(cb_arr.length == 1) { cb_arr.checked = value; } } } </script></p>
<form name="cb_form">
<input name="cb[]" value="0" type="checkbox" />Zero<br />
<input name="cb[]" value="1" type="checkbox" />One<br />
<input name="cb[]" value="2" type="checkbox" />Two<br />
<input name="cb[]" value="3" type="checkbox" /> Three<br />
</form>
<p><a onclick="selectAll('cb_form', 'cb[]', true); return false;" style="color: #000000; text-decoration: underline; cursor: pointer">Check all</a> <a onclick="selectAll('cb_form', 'cb[]', false); return false;" style="color: #000000; text-decoration: underline; cursor: pointer">Uncheck all</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.theerrormessage.com/2007/12/how-to-selectdeselect-a-bunch-of-checkboxes-without-using-ids-for-the-checkbox-inputs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
