<?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/"
	>

<channel>
	<title>Noel Rocha &#187; 2009 &#187; June</title>
	<atom:link href="http://www.noelrocha.com/blog/2009/06/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.noelrocha.com/blog</link>
	<description>Capacitando o sistema...</description>
	<pubDate>Sun, 07 Jun 2009 22:09:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>O que o IE 8 tem que o Firefox não tem</title>
		<link>http://www.noelrocha.com/blog/2009/06/07/o-que-o-ie-8-tem-que-o-firefox-nao-tem/</link>
		<comments>http://www.noelrocha.com/blog/2009/06/07/o-que-o-ie-8-tem-que-o-firefox-nao-tem/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 22:09:50 +0000</pubDate>
		<dc:creator>Noel Rocha</dc:creator>
		
		<category><![CDATA[Dicas]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[Outros]]></category>

		<category><![CDATA[Programação]]></category>

		<category><![CDATA[Tecnologia]]></category>

		<category><![CDATA[Internet Explorer 8]]></category>

		<category><![CDATA[Nova sessão]]></category>

		<category><![CDATA[recursos novos]]></category>

		<guid isPermaLink="false">http://www.noelrocha.com/blog/?p=346</guid>
		<description><![CDATA[Eu nunca fui fã do IE e na maioria das vezes eu utilizo-o por necessidade seja para testar compatibilidade de sites que faço com outros navegadores ou para acessar sites que burramente só funcionam no IE.
Certa vez estudando o IE descobri que ele tem uma opção chamada &#8220;Nova sessão&#8220;.

Se você é programador web já deve [...]]]></description>
			<content:encoded><![CDATA[<p>Eu nunca fui fã do <strong>IE </strong>e na maioria das vezes eu utilizo-o por necessidade seja para testar compatibilidade de <strong>sites que faço</strong> com outros navegadores ou para acessar sites que <strong>burramente</strong> só funcionam no IE.</p>
<p>Certa vez estudando o IE descobri que ele tem uma opção chamada &#8220;<strong>Nova sessão</strong>&#8220;.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-348" title="ie8-vs-firefox1" src="http://www.noelrocha.com/blog/wp-content/uploads/2009/06/ie8-vs-firefox1.gif" alt="O que o IE 8 tem que o Firefox não tem" width="393" height="215" /></p>
<p>Se você é <strong>programador web</strong> já deve fazer idéia o que é isso e como é útil. Para quem não conhece vou explicar o que é e como pode ser útil.</p>
<p>Uma sessão seria um bilhete, passaporte, flyer e sendo mais específico um identificador entre o seu navegador e o servidor. Esse identificador é gerado de acordo com o nome do site que você está acessando e o tipo de navegador que você está utilizando.</p>
<p>Geralmente sessão é utilizada em sites como o do painel da HostNet, Gmail, Orkut e etc&#8230; para permanecer logado mesmo quando você fecha a janela ou aba e reabre novamente.</p>
<p>A opção &#8220;<strong>Nova Sessão</strong>&#8221; do IE 8 permite que você logue no Gmail, Orkut, painel da HostNet com várias contas diferentes. Por exemplo, eu posso logar com meu usuário no Orkut em uma sessão e depois abrir uma nova sessão e logar com meu usuário Fake. Nesse caso em cada sessão só terá dados pertecentes ao perfil que eu loguei.</p>
<p>Exista um site que gerenciava informações de várias empresas e para você ver a informação de uma empresa você teria que logar com o usuário referente a ela. Caso você quisesse ver informações de outra empresa você teria que deslogar de uma empresa e logar na outra. Com o tempo surgiu a necessidade de comparar dados de duas ou mais empresas lado a lado porém seria trabalhoso ficar logando e deslogando toda hora que fosse necessário ver informações de uma empresa.</p>
<p>Uma solução rápida na época a nível de servidores foi criar um alias no Virtual Host que recebesse qualquer coisa como subdomínio. Exemplo:<br />
*.site_comparador_de_empresas.com</p>
<p>Assim quando fosse necessário abrir informações de 2 empresas bastava abrir uma nova aba e digitar algo antes do domínio principal e logar com os dados da segunda empresa. Exemplo:<br />
segunda_empresa.site_comparador_de_empresas.com</p>
<p>Desse jeito era criada uma nova sessão para o domínio  segunda_empresa.site_comprador_de_empresas.com.</p>
<p>Talvez o Firefox também adote essa solução e a que citei fique obsoleta.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.noelrocha.com/blog/2009/06/07/o-que-o-ie-8-tem-que-o-firefox-nao-tem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tabela de Produto com preço total gerado a cada seleção</title>
		<link>http://www.noelrocha.com/blog/2009/06/07/tabela-de-produto-com-preco-total-gerado-a-cada-selecao/</link>
		<comments>http://www.noelrocha.com/blog/2009/06/07/tabela-de-produto-com-preco-total-gerado-a-cada-selecao/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 20:38:59 +0000</pubDate>
		<dc:creator>Noel Rocha</dc:creator>
		
		<category><![CDATA[Dicas]]></category>

		<category><![CDATA[Programação]]></category>

		<category><![CDATA[Tutoriais]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[Faculdade]]></category>

		<category><![CDATA[HTML]]></category>

		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.noelrocha.com/blog/?p=331</guid>
		<description><![CDATA[Esse foi um exercício bastante interessante que tive semana passada na faculdade durante a aula de Linguagem de Script do professor Carlos Sicsu. Nesse aplicativo que faremos será utilizado as tecnologias HTML, DOM e JAVASCRIPT.
O enunciado do exercício era o seguinte:
Construir uma página que contenha uma tabela chamada &#8220;produto-preco&#8221;. A cada selecao de um produto, [...]]]></description>
			<content:encoded><![CDATA[<p>Esse foi um exercício bastante interessante que tive semana passada na faculdade durante a aula de <strong>Linguagem de Script</strong> do professor<a title="Currículo Lattes" href="http://buscatextual.cnpq.br/buscatextual/visualizacv.jsp?id=K4701776P6" target="_blank"> Carlos Sicsu</a>. Nesse aplicativo que faremos será utilizado as tecnologias <strong>HTML</strong>, <strong>DOM </strong>e <strong>JAVASCRIPT</strong>.</p>
<p>O enunciado do exercício era o seguinte:<br />
<em>Construir uma página que contenha uma tabela chamada &#8220;produto-preco&#8221;. A cada selecao de um produto, o preco total de compra deve ser visualizado ao final da tabela. O preço poderá conter casas decimais.<br />
</em></p>
<p>Criando função <em>calc_value_of_selected_products()</em> em JavaScript que calculará o preço total dos produtos:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">function</span> calc_price_of_selected_products<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Obtendo formulário que contém os checkboxes com o valor dos produtos</span>
	<span style="color: #003366; font-weight: bold;">var</span> products    <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;product&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #006600; font-style: italic;">// Preço será do tipo float por causa dos produtos que podem ter</span>
	<span style="color: #006600; font-style: italic;">// centavos em seu valor</span>
	<span style="color: #003366; font-weight: bold;">var</span> total_price <span style="color: #339933;">=</span> <span style="color: #CC0000;">0.0</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// Verificando quais checkboxes foram selecionados e somando seu valor;</span>
  	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> products.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>products<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">checked</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			total_price <span style="color: #339933;">=</span> total_price <span style="color: #339933;">+</span> parseFloat<span style="color: #009900;">&#40;</span>products<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// Atualizando div que contém o preço total dos produtos</span>
	document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;total&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Total: R$ &quot;</span> <span style="color: #339933;">+</span> total_price.<span style="color: #660066;">toFixed</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Para que o valor em centavos fique com 2 casas decimais é necessário usar a função <strong>toFixed()</strong>. Exemplo de seu uso:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">parseFloat<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;10.2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toFixed</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// 10.20</span>
parseFloat<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;100&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toFixed</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// 100.00</span></pre></div></div>

<p>O preço de cada produto ficará dentro do value em cada checkbox. O checkbox deverá chamar a função calc_price_of_selected_product() que criamos toda vez que for clicado nele.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;135.00&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;calc_price_of_selected_products()&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

<p> A Construindo a estrutura da tabela em <strong>HTML</strong> com alguns produtos e seus respectivos preços:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;product&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">table</span> <span style="color: #000066;">border</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>Produtos<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>R$<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;135.99&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;calc_price_of_selected_products()&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>Oculos<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>135.99<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;53.20&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;calc_price_of_selected_products()&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>Sunga<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>53.20<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;97.30&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;calc_price_of_selected_products()&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>Biquini<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>97.30<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">table</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<p>A soma de todos os valores selecionados deverá ser exibido pela div total. Essa div deverá ser inserida após o formulário.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;total&quot;</span>&gt;</span>Total: R$ 0.00<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>O funcionamento desse script pode ser visto no endereço abaixo:<br />
<a href=" http://www.noelrocha.com/blog/examples/tabela_produtos_preco.html" target="_new"> http://www.noelrocha.com/blog/examples/tabela_produtos_preco.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.noelrocha.com/blog/2009/06/07/tabela-de-produto-com-preco-total-gerado-a-cada-selecao/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

