<?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>Cyberactiva web development and optimisation &#187; javascript</title>
	<atom:link href="http://www.cyberactiva.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cyberactiva.com</link>
	<description>Every day&#039;s life about programming and webmarketing</description>
	<lastBuildDate>Wed, 21 Oct 2009 11:33:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Select tag clickable under the above transparent div layer</title>
		<link>http://www.cyberactiva.com/2009/10/select-tag-clickable-under-the-above-transparent-div-layer/</link>
		<comments>http://www.cyberactiva.com/2009/10/select-tag-clickable-under-the-above-transparent-div-layer/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 08:34:36 +0000</pubDate>
		<dc:creator>Claudio Barba</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.cyberactiva.com/?p=34</guid>
		<description><![CDATA[<p>It bothers me a lot, when I can&#8217;t find a solution for a problem that do not depend on me&#8230; Anywway here is the problem and the work-around solution I found.</p>
<p>Let&#8217;s say you have a form on the page, with some &#60;select&#62; tags.</p>
<p>Now, you want that on the onclick event of the submit,  a semi [...]]]></description>
			<content:encoded><![CDATA[<p>It bothers me a lot, when I can&#8217;t find a solution for a problem that do not depend on me&#8230; Anywway here is the problem and the work-around solution I found.</p>
<p>Let&#8217;s say you have a form on the page, with some &lt;select&gt; tags.</p>
<p>Now, you want that on the onclick event of the submit,  a semi transparent DIV appears above the form, in order to block the user to change the data on the form.</p>
<p>The .html (or whatever you are using) should be like:</p>
<blockquote><p>&lt;script language=&#8221;JavaScript&#8221;&gt;<br />
function show(layer_ref) {</p>
<p>  if (document.all) { //for IE 4 or 5 (or 6 beta)<br />
    eval( &#8220;document.all.&#8221; + layer_ref + &#8220;.style.display = &#8216;block&#8217;&#8221;);<br />
  }<br />
  if (document.layers) { //for NETSCAPE 4 or below<br />
    document.layers[layer_ref].display = &#8216;block&#8217;;<br />
  }<br />
  if (document.getElementById &amp;&amp;!document.all) {<br />
    myel = document.getElementById(layer_ref);<br />
    myel.style.display = &#8216;block&#8217;;<br />
  }<br />
}<br />
&lt;/script&gt;<br />
&lt;div id=&#8221;form1&#8243;&gt;<br />
 &lt;form&gt;<br />
  &lt;select name=&#8221;test&#8221;&gt;<br />
   &lt;option&gt;test&lt;/option&gt;<br />
  &lt;/select&gt;<br />
  &lt;input type=&#8221;submit&#8221; onclick=&#8221;javascript:show(&#8217;waiting&#8217;);&#8221;&gt;<br />
 &lt;/form&gt;<br />
&lt;/div&gt;<br />
&lt;div id=&#8221;waiting&#8221; style=&#8221;display:none;&#8221;&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>In the css, you should put</p>
<blockquote><p>#waiting {<br />
 position:absolute;<br />
 width: 100%;<br />
 height: 100%;<br />
 top:0;<br />
 left:0;<br />
 background: #cccccc;<br />
 z-index:2;<br />
 -moz-opacity:0.5;<br />
 opacity:0.5;<br />
 filter: Alpha(opacity:80);</p>
<p>}</p></blockquote>
<p>The problem will immediately appear when you launch the page and click on the submit&#8230;</p>
<p>Actually, the select tag will remain active, even if it is under the &#8220;waiting&#8221; layer.</p>
<p>The only solution I found, is to hide the DIV form1&#8230; so, from the above code you should change only:</p>
<blockquote><p>onclick=&#8221;javascript:show(&#8217;waiting&#8217;);hide(&#8217;form1&#8242;);&#8221;</p></blockquote>
<p>and of course add the new hide javascript function (just change &#8216;block&#8217; with &#8216;none&#8217;):</p>
<blockquote><p>function hide(layer_ref) {</p>
<p>  if (document.all) { //for IE 4 or 5 (or 6 beta)<br />
    eval( &#8220;document.all.&#8221; + layer_ref + &#8220;.style.display = &#8216;none&#8217;&#8221;);<br />
  }<br />
  if (document.layers) { //for NETSCAPE 4 or below<br />
    document.layers[layer_ref].display = &#8216;none&#8217;;<br />
  }<br />
  if (document.getElementById &amp;&amp;!document.all) {<br />
    myel = document.getElementById(layer_ref);<br />
    myel.style.display = &#8216;none&#8217;;<br />
  }<br />
}</p></blockquote>
<p>I am very curious to know if somebody could solve this issue differently, LET ME KNOW!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberactiva.com/2009/10/select-tag-clickable-under-the-above-transparent-div-layer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AJAX example</title>
		<link>http://www.cyberactiva.com/2009/09/ajax-example/</link>
		<comments>http://www.cyberactiva.com/2009/09/ajax-example/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 12:28:12 +0000</pubDate>
		<dc:creator>Claudio Barba</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.cyberactiva.com/?p=27</guid>
		<description><![CDATA[<p>There are tons of places on the net where you can find some ajax tutorial on how to make hidden calls to the server.
Anyway, I put here a basic javascript function (may be more for my reference). For instance I have to send three parameters v1,v2,v3 to the checkdate.php server page and receive back a [...]]]></description>
			<content:encoded><![CDATA[<p>There are tons of places on the net where you can find some ajax tutorial on how to make hidden calls to the server.<br />
Anyway, I put here a basic javascript function (may be more for my reference). For instance I have to send three parameters v1,v2,v3 to the checkdate.php server page and receive back a code. If the code is equal to 1, then I show the errors&#8217; layer and hide the buttons&#8217; layer.</p>
<blockquote><p>function ajaxsend (v1,v2,v3)<br />
{<br />
var xajax = null;</p>
<p>if(window.XMLHttpRequest) xajax = new XMLHttpRequest();<br />
else if(window.ActiveXObject) xajax = new ActiveXObject &#8220;Microsoft.XMLHTTP&#8221;);<br />
else return(false);</p>
<p>var str = &#8220;chky=&#8221;+v1+&#8221;&amp;chkm=&#8221;+v2+&#8221;&amp;chkd=&#8221;+v3;<br />
xajax.open(&#8221;POST&#8221;,&#8221;./checkdate.php&#8221;,false);<br />
xajax.setRequestHeader(&#8221;Content-Type&#8221;,&#8221;application/x-www-form-urlencoded&#8221;);<br />
xajax.send(str);</p>
<p>if(xajax.readyState == 4) {<br />
if (xajax.responseText==&#8221;1&#8243;) { //&lt;15years<br />
hide(&#8217;buttons&#8217;);<br />
show(&#8217;errors&#8217;);<br />
}<br />
}<br />
}</p></blockquote>
<p>Just to be complete, here are the two functions hide and show, written in a &#8220;browser independent&#8221; way:</p>
<blockquote><p>function show(layer_ref) {</p>
<p>  if (document.all) { //IS IE 4 or 5 (or 6 beta)<br />
    eval( &#8220;document.all.&#8221; + layer_ref + &#8220;.style.display = &#8216;block&#8217;&#8221;);<br />
  }<br />
  if (document.layers) { //IS NETSCAPE 4 or below<br />
    document.layers[layer_ref].display = &#8216;block&#8217;;<br />
  }<br />
  if (document.getElementById &amp;&amp;!document.all) {<br />
    mylayer = document.getElementById(layer_ref);<br />
    mylayer.style.display = &#8216;block&#8217;;<br />
  }<br />
}</p>
<p>function hide(layer_ref) {</p>
<p>  if (document.all) { //IS IE 4 or 5 (or 6 beta)<br />
    eval( &#8220;document.all.&#8221; + layer_ref + &#8220;.style.display = &#8216;none&#8217;&#8221;);<br />
  }<br />
  if (document.layers) { //IS NETSCAPE 4 or below<br />
    document.layers[layer_ref].display = &#8216;none&#8217;;<br />
  }<br />
  if (document.getElementById &amp;&amp;!document.all) {<br />
    mylayer = document.getElementById(layer_ref);<br />
    mylayer.style.display = &#8216;none&#8217;;<br />
  }<br />
}</p></blockquote>
<p>I hope you will find this example useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberactiva.com/2009/09/ajax-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
