<?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>Web Dev Bros &#187; protoypejs</title>
	<atom:link href="http://www.webdevbros.net/category/protoypejs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdevbros.net</link>
	<description>hot talk about web development</description>
	<lastBuildDate>Wed, 16 Dec 2009 12:59:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>create a contextmenu with javascript &amp; prototypejs in seconds</title>
		<link>http://www.webdevbros.net/2008/04/08/create-a-contextmenu-with-javascript-prototypejs-in-seconds/</link>
		<comments>http://www.webdevbros.net/2008/04/08/create-a-contextmenu-with-javascript-prototypejs-in-seconds/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 17:44:43 +0000</pubDate>
		<dc:creator>Michal</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[protoypejs]]></category>
		<category><![CDATA[scriptaculous]]></category>
		<category><![CDATA[user interface design]]></category>
		<category><![CDATA[contextmenu]]></category>
		<category><![CDATA[google calendar]]></category>
		<category><![CDATA[menu]]></category>

		<guid isPermaLink="false">http://www.webdevbros.net/2008/04/08/create-a-contextmenu-with-javascript-prototypejs-in-seconds/</guid>
		<description><![CDATA[Did you ever wanted to build a context menu like google does it? I have figured out an easy and quick way to achieve this with a small amount of CSS and 3 lines of javascript.

Click here for a demo

All you need to get started is the latest version of prototypejs. I bet you have [...]]]></description>
			<content:encoded><![CDATA[<p>Did you ever wanted to build a context menu like google does it? I have figured out an easy and quick way to achieve this with a small amount of CSS and 3 lines of javascript.</p>
<p><a href='http://www.webdevbros.net/wp-content/uploads/2008/04/contextmenu1.html' title='contextmenu.html'><img src='http://www.webdevbros.net/wp-content/uploads/2008/04/contextmenu.png' alt='contextmenu.png' border="0"/></a></p>
<p><a href='http://www.webdevbros.net/wp-content/uploads/2008/04/contextmenu1.html' title='contextmenu.html' targer="_blank">Click here for a demo</a><br />
<span id="more-157"></span></p>
<p>All you need to get started is the latest version of <a href="http://prototypejs.org/">prototypejs</a>. I bet you have it already ;)<br />
We will build our menu with the following structure:</p>
<div class="igBar"><span id="lhtml-4"><a href="#" onclick="javascript:showCodeTxt('html-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-4">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"menu"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">""</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>item<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; ...</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">""</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>more...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>First there comes the div container which is called <code>menu</code> in this example. It contains the menu items which are ordinary <code>a tags</code>. After the menu we place a link which will display our contextmenu. Now lets apply some style to the menu so it really looks like a nice contextmenu. Apply the following styles..</p>
<div class="igBar"><span id="lcss-5"><a href="#" onclick="javascript:showCodeTxt('css-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-5">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc00cc;">#menu <span style="color: #66cc66;">&#123;</span></span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">absolute</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; border<span style="color: #3333ff;">:1px </span>outset #aaa;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; border-right<span style="color: #3333ff;">:2px </span>outset #aaa;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#fff;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; margin<span style="color: #3333ff;">:8px </span>0px 0px 8px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#menu a <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">display</span>:<span style="color: #993333;">block</span>;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; padding<span style="color: #3333ff;">:4px </span>20px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; border-bottom<span style="color: #3333ff;">:1px </span>solid #aaa;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">font-weight</span>:<span style="color: #993333;">bold</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p> </p>
<p>We positioned the menu <code>absolute</code> therfore it will appear over the "more..." link. Thats good because we want to have the menu on our mouse when we click the link. The <code>margin</code> moves it a bit away so we can still see the link a little. The rest is for nice appereance. Oh, i forgot: the links within the menu are displayed as <code>block</code>. Thats for the line breaks.</p>
<p>The only thing which is missing now is tons of Javascript. Hmm, not really. We are fine with 3 statements. We don't calculate any positions of the menu, because it is already positioned. Thats the nice thing and makes us write less javascript. ok, lets tune our html..</p>
<div class="igBar"><span id="lhtml-6"><a href="#" onclick="javascript:showCodeTxt('html-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-6">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"menu"</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"display:none"</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066;">onmousemove</span>=<span style="color: #ff0000;">"$(this).show()"</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066;">onmouseout</span>=<span style="color: #ff0000;">"$(this).hide()"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"#"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>item<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"javascript:void(0)"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"$('menu').show()"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; more...</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>When the user clicks on <code>more...</code> we show the menu (<code>$('menu').show()</code>). Now we have to keep it visible till he/she moves away the mouse out of the menu. For this reason we keep showing it <code>onmousemove</code>. Finally if the mouse leaves the menu we hide it (<code>$(this).hide()</code>).</p>
<p>Last but not least we added <code>display:none</code> because the menu should not be visible by default (note: you have to assign this inline, otherwise it wont work. For more details check the prototypejs API). </p>
<p>Get the full source code <a href='http://www.webdevbros.net/wp-content/uploads/2008/04/contextmenu1.html' title='contextmenu.html'>here</a> by viewing the source. If you are familiar with <a href="http://script.aculo.us">script.aculo.us</a> you could add nice effects when showing and hiding the menu. (<code>Effect.Appear</code> and <code>Effect.Fade</code>)</p>
<p><strong>Tested in IE7, FF2</strong></p>
<p>I use this kind of menus in all my apps. If you need more menus in one page. e.g. context menu for a user (delete, modify, permissions) then just render an own menu for each person. It generates more HTML but makes it easy to use.</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.webdevbros.net/2008/04/08/create-a-contextmenu-with-javascript-prototypejs-in-seconds/&amp;t=create+a+contextmenu+with+javascript+%26+prototypejs+in+seconds&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.webdevbros.net/2008/04/08/create-a-contextmenu-with-javascript-prototypejs-in-seconds/&amp;title=create+a+contextmenu+with+javascript+%26+prototypejs+in+seconds&amp;t=2 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.webdevbros.net/2008/04/08/create-a-contextmenu-with-javascript-prototypejs-in-seconds/&amp;title=create+a+contextmenu+with+javascript+%26+prototypejs+in+seconds&amp;t=1 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=create+a+contextmenu+with+javascript+%26+prototypejs+in+seconds;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=square></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.webdevbros.net/2008/04/08/create-a-contextmenu-with-javascript-prototypejs-in-seconds/'; tweetmeme_style = 'normal';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.webdevbros.net/2008/04/08/create-a-contextmenu-with-javascript-prototypejs-in-seconds/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Library with extensions for prototypejs and script.aculo.us</title>
		<link>http://www.webdevbros.net/2007/12/21/library-with-extensions-for-prototypejs-and-scriptaculous/</link>
		<comments>http://www.webdevbros.net/2007/12/21/library-with-extensions-for-prototypejs-and-scriptaculous/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 14:47:24 +0000</pubDate>
		<dc:creator>Michal</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[protoypejs]]></category>
		<category><![CDATA[scriptaculous]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.webdevbros.net/2007/12/21/library-with-extensions-for-prototypejs-and-scriptaculous/</guid>
		<description><![CDATA[ Today i have found scripteka.com which is an awesome resource for prototype and scriptaculous extensions. It offers one of the best extensions around on a very clear and web2ish site. Currently they offer 88 extensions which include javascript calendars, password strength meters, reflection generators, image croppers, faders, .... Go to scripteka.com and look yourself [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.webdevbros.net/wp-content/uploads/2007/12/prototype_extensions.gif' alt='prototype extensions library' align="left" /> Today i have found <a href="http://www.scripteka.com/">scripteka.com</a> which is an awesome resource for prototype and scriptaculous extensions. It offers one of the best extensions around on a very clear and web2ish site. Currently they offer 88 extensions which include javascript calendars, password strength meters, reflection generators, image croppers, faders, .... Go to <a href="http://www.scripteka.com/">scripteka.com</a> and look yourself what they offer. Its good stuff which is based on one of the best libraries out there.</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.webdevbros.net/2007/12/21/library-with-extensions-for-prototypejs-and-scriptaculous/&amp;t=Library+with+extensions+for+prototypejs+and+script.aculo.us&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.webdevbros.net/2007/12/21/library-with-extensions-for-prototypejs-and-scriptaculous/&amp;title=Library+with+extensions+for+prototypejs+and+script.aculo.us&amp;t=2 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.webdevbros.net/2007/12/21/library-with-extensions-for-prototypejs-and-scriptaculous/&amp;title=Library+with+extensions+for+prototypejs+and+script.aculo.us&amp;t=1 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Library+with+extensions+for+prototypejs+and+script.aculo.us;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=square></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.webdevbros.net/2007/12/21/library-with-extensions-for-prototypejs-and-scriptaculous/'; tweetmeme_style = 'normal';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.webdevbros.net/2007/12/21/library-with-extensions-for-prototypejs-and-scriptaculous/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ajaxed: Calling server side VBScript procedures from client side (equivalent to PHP xajax)</title>
		<link>http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/</link>
		<comments>http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/#comments</comments>
		<pubDate>Sun, 01 Jul 2007 23:50:56 +0000</pubDate>
		<dc:creator>Michal</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[ajaxed]]></category>
		<category><![CDATA[classic ASP (VBScript)]]></category>
		<category><![CDATA[protoypejs]]></category>
		<category><![CDATA[xajax]]></category>

		<guid isPermaLink="false">http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/</guid>
		<description><![CDATA[My last post (about an ASP RSS component) included a demonstration which made use of a cool ajax technique simply called "ajaxed". See the demonstration here again. If you play around you will recognize that there is no conventional postback and AJAX is up in here ;) I have developed a small "library" which easily [...]]]></description>
			<content:encoded><![CDATA[<p>My last post (about an ASP RSS component) included a demonstration which made use of a cool ajax technique simply called "ajaxed". <a href="http://www.grafix.at/webdevbros/RSS" target="_blank">See the demonstration here again.</a> If you play around you will recognize that there is no conventional postback and AJAX is up in here ;) I have developed a small "library" which easily allows you to call server side ASP VBScrtipt procedures from the client side. No low-level Ajax knowledge is required...<span id="more-78"></span><br />
Summarized it can be said that I have developed a bit similar thing for ASP like there is already for PHP (xajax - <a href="http://www.xajaxproject.org/">http://www.xajaxproject.org/</a>). It is not the same as xajax but it also allows you to call server side procedures from client side. We are all tired of the conventional postbacks which refresh the whole page, thats why we want ajax. I was tired of hacking all the lowlevel stuff for ajax and thought of a way to call the ASP procedures directly. With this and some stuff of my existing gabLibrary I have built a small library called "ajaxed". ajaxed just because it makes my pages ajaxed. Here is a very simple example which sums up two numbers (<a href="http://www.grafix.at/ajaxed/demo.asp" target="_blank">Try the demo here</a>):</p>
<div class="igBar"><span id="lasp-11"><a href="#" onclick="javascript:showCodeTxt('asp-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">ASP:</span>
<div id="asp-11">
<div class="asp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!--#include virtual=<span style="color:#CC0000;">"/ajaxed/ajaxed.asp"</span>--&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">set</span> page = <span style="color:#0000FF; font-weight:bold;">new</span> AjaxedPage</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page.<span style="color:#9900CC;">draw</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> init<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> callback<span style="color:#006600; font-weight:bold;">&#40;</span>action<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">if</span> action = <span style="color:#CC0000;">"add"</span> <span style="color:#990099; font-weight:bold;">then</span> page.<span style="color:#9900CC;">return</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#330066;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span>page.<span style="color:#9900CC;">RF</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"a"</span><span style="color:#006600; font-weight:bold;">&#41;</span>, page.<span style="color:#9900CC;">RF</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"b"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">function</span> <span style="color:#330066;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span>a, b<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">if</span> <span style="color:#990099; font-weight:bold;">not</span> <span style="color:#990099; font-weight:bold;">isnumeric</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#990099; font-weight:bold;">then</span> a = <span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">if</span> <span style="color:#990099; font-weight:bold;">not</span> <span style="color:#990099; font-weight:bold;">isnumeric</span><span style="color:#006600; font-weight:bold;">&#40;</span>b<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#990099; font-weight:bold;">then</span> b = <span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#330066;">add</span> = <span style="color:#990099; font-weight:bold;">cint</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span> + <span style="color:#990099; font-weight:bold;">cint</span><span style="color:#006600; font-weight:bold;">&#40;</span>b<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">function</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> main<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF; font-weight:bold;">%&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;script&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">function</span> added<span style="color:#006600; font-weight:bold;">&#40;</span>sum<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#008000;">'c').value = sum;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">&lt;/script&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;form id=<span style="color:#CC0000;">"frm"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=<span style="color:#CC0000;">"Text"</span> name=<span style="color:#CC0000;">"a"</span> id=<span style="color:#CC0000;">"a"</span>&gt;+</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=<span style="color:#CC0000;">"Text"</span> name=<span style="color:#CC0000;">"b"</span> id=<span style="color:#CC0000;">"b"</span>&gt;=</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=<span style="color:#CC0000;">"Text"</span> name=<span style="color:#CC0000;">"c"</span> id=<span style="color:#CC0000;">"c"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;button onclick=<span style="color:#CC0000;">"ajaxed.callback('add', added)"</span> type=<span style="color:#CC0000;">"button"</span>&gt;calculate&lt;/button&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/form&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span> <span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span> <span style="color:#0000FF; font-weight:bold;">%&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>At first sight you can see that the calculation is done on server side ("add" function) and there is no classical XHR and not much JavaScript. The calculation is invoked through the button and therefore the button includes a JavaScript call which defines the "gateway" to the server side. Before I explain how the execution works, it is necessary to look at the page structure. The structure of an ajaxed page (as shown in the example) is the following:</p>
<ol>
<li>Loading ajaxed.asp (include)</li>
<li>Create an instance of the AjaxedPage class and execute draw()</li>
<li>Provide 3 methods:
<ol>
<li>init(): executed on every request (before main() or callback())</li>
<li>main(): executed when the page is ordinary called by a user</li>
<li>callback(): executed when the page calls itself again and requests a server side method (action)</li>
</ol>
</li>
</ol>
<p>The execution flow results as followed:</p>
<ol>
<li>init()</li>
<li>main() or callback()</li>
</ol>
<p>The whole trick here is that the page is able to make a request to itself. It has two states. One for the ordinary request of the user - which normally displays the user interface with (X)HTML. The other state is when the page requests itself again - which results in a JSON response. Ok lets forget the underlying technical details now...</p>
<p>The entry point in the example is the draw() method which draws the page and cares about everything for you. As already mentioned you need to provide the procedures init(), main() and a callback(action) in your page. Whereas init() is executed on every request the main() and callback() are never executed togehter. All the presentation should be put in the main() - you see the form in the example is in the main(). All security checks, preperations, initializations, etc should be put into the init() which is always executed before the main() and callback(action). When is the callback called? It is called if the ajaxed.callback JavaScript function is executed - which in this case is in the onclick event of the button. The ajaxed.callback requires an action (which is used as input for the server side callback function) and a JavaScript callback function which will be called after the server side process has been finished. This callback function (added) gets then the return of the server side function call. In this case with page.return(). The nice thing is that the page handles all conversions from the VBScript datatypes into the JavaScript equivalents (see <a href="/2007/04/26/generate-json-from-asp-datatypes">Generate JSON from ASP datatypes</a> if you are interested in the details). The page posts all form variables by default to the callback which means that the form fields are accessible via request.form within the callback. The AjaxedPage class offers several convenient utility methods to access the request collection. If you dont want to post the whole form or use your own parameters for the callback, you can use the third parameter of the ajaxed.callback function (with JSON). E.g.</p>
<div class="igBar"><span id="ljavascript-12"><a href="#" onclick="javascript:showCodeTxt('javascript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-12">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ajaxed.<span style="color: #006600;">callback</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'serversideAction'</span>, jsCallback, <span style="color: #66cc66;">&#123;</span>param1:<span style="color: #CC0000;color:#800000;">1</span>, param2:<span style="color: #3366CC;">'michal'</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>With this technique its now possible to call all your server side procedures and then change the DOM according to the return value(s) from the server side. There is no need to care about any XHR or e.g. loading indication. Everything is handled. Another example?</p>
<p><strong>Populating dropdown from the database</strong></p>
<p>Lets assume we have a table called "table" which holds two columns named "id" and "name". We want to fill a dropdown with those values. id as the value and name as the displayed text. I have created a form which holds dropdown and a button. The button invokes the database call on server side. The callback then returns an ADODB.recordset which is automatically converted into an equivalent JavaScript data structure. The "got" JavaScript function can directly access the recordsets data. (Note: the "getRecordset" function does not exist and is just for demonstration)</p>
<div class="igBar"><span id="lasp-13"><a href="#" onclick="javascript:showCodeTxt('asp-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">ASP:</span>
<div id="asp-13">
<div class="asp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!--#include virtual=<span style="color:#CC0000;">"/ajaxed/ajaxed.asp"</span>--&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">set</span> page = <span style="color:#0000FF; font-weight:bold;">new</span> AjaxedPage</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page.<span style="color:#9900CC;">draw</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> init<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> callback<span style="color:#006600; font-weight:bold;">&#40;</span>action<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">if</span> action = <span style="color:#CC0000;">"get"</span> <span style="color:#990099; font-weight:bold;">then</span> page.<span style="color:#9900CC;">return</span><span style="color:#006600; font-weight:bold;">&#40;</span>getRecordset<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"SELECT * FROM table"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> main<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF; font-weight:bold;">%&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;script&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">function</span> got<span style="color:#006600; font-weight:bold;">&#40;</span>recs<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span>i = <span style="color:#800000;color:#800000;">0</span>; i &lt;recs.<span style="color:#9900CC;">length</span>; i++<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">var</span> o = <span style="color:#0000FF; font-weight:bold;">new</span> <span style="color:#0000FF; font-weight:bold;">Option</span><span style="color:#006600; font-weight:bold;">&#40;</span>recs<span style="color:#006600; font-weight:bold;">&#91;</span>i<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">name</span>, recs<span style="color:#006600; font-weight:bold;">&#91;</span>i<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">id</span>, <span style="color:#0000FF; font-weight:bold;">false</span>, <span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#008000;">'dd').options[$('dd').options.length] = o;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;form id=<span style="color:#CC0000;">"frm"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;select id=<span style="color:#CC0000;">"dd"</span>&gt;&lt;/select&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;button onclick=<span style="color:#CC0000;">"ajaxed.callback('get', got)"</span> type=<span style="color:#CC0000;">"button"</span>&gt;load&lt;/button&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/form&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span> <span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span> <span style="color:#0000FF; font-weight:bold;">%&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Returning more values with returnValue()</strong></p>
<p>The following example demonstrates that it is also possible to return more values on the callback. returnValue() allows to return more values by specifying each value with a name. return() in comparision can only return one value.</p>
<p><a href="http://www.grafix.at/webdevbros/ajaxed2.asp">Run the example</a></p>
<p>(It expects some value in the textbox. if no value is given then a "valid" flag is set to false and returned from server side. If some input is provided then an array additionally to the valid flag is returned. This example make not much sense but demonstrates the usage of more return values)</p>
<div class="igBar"><span id="lasp-14"><a href="#" onclick="javascript:showCodeTxt('asp-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">ASP:</span>
<div id="asp-14">
<div class="asp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!--#include virtual=<span style="color:#CC0000;">"/ajaxed/ajaxed.asp"</span>--&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">set</span> page = <span style="color:#0000FF; font-weight:bold;">new</span> AjaxedPage</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">page.<span style="color:#9900CC;">draw</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> init<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> callback<span style="color:#006600; font-weight:bold;">&#40;</span>action<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">if</span> action = <span style="color:#CC0000;">"do"</span> <span style="color:#990099; font-weight:bold;">then</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color:#9900CC;">returnValue</span> <span style="color:#CC0000;">"valid"</span>, page.<span style="color:#9900CC;">RFHas</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"code"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">if</span> page.<span style="color:#9900CC;">RFHas</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"code"</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#990099; font-weight:bold;">then</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color:#9900CC;">returnValue</span> <span style="color:#CC0000;">"even"</span>, <span style="color:#990099; font-weight:bold;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">2</span>, <span style="color:#800000;color:#800000;">4</span>, <span style="color:#800000;color:#800000;">6</span>, <span style="color:#800000;color:#800000;">8</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">end</span> <span style="color:#990099; font-weight:bold;">if</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">end</span> <span style="color:#990099; font-weight:bold;">if</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">sub</span> main<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF; font-weight:bold;">%&gt;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;script&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">function</span> done<span style="color:#006600; font-weight:bold;">&#40;</span>r<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>r.<span style="color:#9900CC;">valid</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#990099; font-weight:bold;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span>i = <span style="color:#800000;color:#800000;">0</span>; i &lt;r.<span style="color:#9900CC;">even</span>.<span style="color:#9900CC;">length</span>; i++<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#008000;">'vals').innerHTML += r.even[i] + &quot;&lt;br&gt;&quot;;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#990099; font-weight:bold;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"type in something!"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;form id=<span style="color:#CC0000;">"frm"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=<span style="color:#CC0000;">"vals"</span>&gt;&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=<span style="color:#CC0000;">"Text"</span> name=<span style="color:#CC0000;">"code"</span> <span style="color:#330066;">value</span>=<span style="color:#CC0000;">""</span>&gt; <span style="color:#006600; font-weight:bold;">&#40;</span>type <span style="color:#990099; font-weight:bold;">in</span> something<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;button onclick=<span style="color:#CC0000;">"ajaxed.callback('do', done)"</span> type=<span style="color:#CC0000;">"button"</span>&gt;load&lt;/button&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/form&gt;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span> <span style="color:#990099; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">sub</span> <span style="color:#0000FF; font-weight:bold;">%&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The concept makes use of <a href="www.prototypejs.org">Prototype JavaScript Library</a> and the <a href="/2007/04/26/generate-json-from-asp-datatypes">JSON utility class</a>.<br />
The ajaxed library includes those and therefore they can be used when working with ajaxed e.g. all features of Prototype. Furthermore it offers other convenient built-in features to ease the work with ASP pages (e.g. RFHas() method in the example above - it checks if agiven field from the request.form collection exists). Some other features of the Ajaxed page ...</p>
<ul>
<li>AjaxedPage.isPostback() - equivalent to asp.net postback</li>
<li>AjaxedPage.throwError() - generates an ASP user error</li>
<li>AjaxedPage.RFT() - gets a field from the request collection already trimmed</li>
<li>AjaxedPage.RFE() - gets a field from the request collection HTMLEncoded</li>
<li>AjaxedPage.loadJSFile() - ensures that JavaScript file is loaded only once</li>
<li>AjaxedPage.iif() - an VBScript inline if</li>
<li>AjaxedPage.getLocation() - gets the location of the page in several formats</li>
</ul>
<p><a href='/wp-content/uploads/2007/07/ajaxed01.zip' title='ajaxed 0.1'>Download ajaxed 0.1</a><br />
<a href='http://www.grafix.at/ajaxed/' title='ajaxed 0.1'>ajaxed 0.1 class reference</a></p>
<p><strong>Installation</strong></p>
<p>Download the zip archive and copy the whole "ajaxed" folder into your web root. Access the demo at  http://yourserver.com/ajaxed/demo/index.asp and check if everything works fine. There is a config.asp which provides some configurations.</p>
<p>Tell me what you think about it. I will come up with some more sophisticated examples in the future. cheeers...</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/&amp;t=ajaxed%3A+Calling+server+side+VBScript+procedures+from+client+side+%28equivalent+to+PHP+xajax%29&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/&amp;title=ajaxed%3A+Calling+server+side+VBScript+procedures+from+client+side+%28equivalent+to+PHP+xajax%29&amp;t=2 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/&amp;title=ajaxed%3A+Calling+server+side+VBScript+procedures+from+client+side+%28equivalent+to+PHP+xajax%29&amp;t=1 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=ajaxed%3A+Calling+server+side+VBScript+procedures+from+client+side+%28equivalent+to+PHP+xajax%29;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=square></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/'; tweetmeme_style = 'normal';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Web 2.0 balloon tooltip with prototype and scriptaculous</title>
		<link>http://www.webdevbros.net/2007/05/29/web-20-balloon-tooltip-with-prototype-and-scriptaculous/</link>
		<comments>http://www.webdevbros.net/2007/05/29/web-20-balloon-tooltip-with-prototype-and-scriptaculous/#comments</comments>
		<pubDate>Tue, 29 May 2007 21:20:46 +0000</pubDate>
		<dc:creator>Michal</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[protoypejs]]></category>
		<category><![CDATA[scriptaculous]]></category>
		<category><![CDATA[user interface design]]></category>

		<guid isPermaLink="false">http://www.webdevbros.net/2007/05/29/web-20-balloon-tooltip-with-prototype-and-scriptaculous/</guid>
		<description><![CDATA[A very nice balloon tooltip from BeauScott.com is another gift of the web 2.0 era. Look at the stylish appearance and enjoy...

This beauty from BeauScott uses the prototype javascript library including some little extensions and scriptaculous. Supported features are for example getting the tooltips content direclty from an XML or HTML file. Furthermore its interface [...]]]></description>
			<content:encoded><![CDATA[<p>A very nice balloon tooltip from <a href="www.BeauScott.com">BeauScott.com</a> is another gift of the web 2.0 era. Look at the stylish appearance and enjoy...</p>
<p><img src='/wp-content/uploads/2007/05/tooltip.gif' alt='Balloon tooltip' /><span id="more-69"></span></p>
<p>This beauty from BeauScott uses the <a href="www.prototypejs.org">prototype javascript library</a> including some little extensions and <a href="http://script.aculo.us">scriptaculous</a>. Supported features are for example getting the tooltips content direclty from an XML or HTML file. Furthermore its interface for the usage is simple as well. Example:</p>
<div class="igBar"><span id="ljavascript-16"><a href="#" onclick="javascript:showCodeTxt('javascript-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-16">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> h = <span style="color: #003366; font-weight: bold;">new</span> HelpBalloon<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;title: <span style="color: #3366CC;">'Webdevbros.com'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;content: <span style="color: #3366CC;">'webdevbros is providing you some freaky content.'</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here is the original post from Beau Scott:<br />
<a href="http://www.beauscott.com/2006/08/19/ajax-enabled-help-balloons/">http://www.beauscott.com/2006/08/19/ajax-enabled-help-balloons/</a></p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.webdevbros.net/2007/05/29/web-20-balloon-tooltip-with-prototype-and-scriptaculous/&amp;t=Web+2.0+balloon+tooltip+with+prototype+and+scriptaculous&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.webdevbros.net/2007/05/29/web-20-balloon-tooltip-with-prototype-and-scriptaculous/&amp;title=Web+2.0+balloon+tooltip+with+prototype+and+scriptaculous&amp;t=2 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.webdevbros.net/2007/05/29/web-20-balloon-tooltip-with-prototype-and-scriptaculous/&amp;title=Web+2.0+balloon+tooltip+with+prototype+and+scriptaculous&amp;t=1 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Web+2.0+balloon+tooltip+with+prototype+and+scriptaculous;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=square></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.webdevbros.net/2007/05/29/web-20-balloon-tooltip-with-prototype-and-scriptaculous/'; tweetmeme_style = 'normal';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.webdevbros.net/2007/05/29/web-20-balloon-tooltip-with-prototype-and-scriptaculous/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FormWalker &#8211; walking through form fields with the enter key</title>
		<link>http://www.webdevbros.net/2007/04/16/formwalker-walking-through-form-fields-with-the-enter-key/</link>
		<comments>http://www.webdevbros.net/2007/04/16/formwalker-walking-through-form-fields-with-the-enter-key/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 14:07:24 +0000</pubDate>
		<dc:creator>Michal</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[protoypejs]]></category>
		<category><![CDATA[user interface design]]></category>

		<guid isPermaLink="false">http://fabiankoehler.de/wdb/?p=31</guid>
		<description><![CDATA[In conventional business applications users are used to navigate through form fields just by using the "enter" key rather than using the "tab" key. Especially on forms where they bung in a lot of numeric data (e.g. sales) it's more common to use the numeric block (numlock) and therefore the "enter" key is more convenient to use [...]]]></description>
			<content:encoded><![CDATA[<p>In conventional business applications users are used to navigate through form fields just by using the "enter" key rather than using the "tab" key. Especially on forms where they bung in a lot of numeric data (e.g. sales) it's more common to use the numeric block (numlock) and therefore the "enter" key is more convenient to use ... cause there is no tab key. I've just written a short javascript snippet which solves this problem. I call it FormWalking.<span id="more-31"></span></p>
<p>It's a straight forward task so I dont really want to write a lot about (the code is at the bottom for all who cannot wait). What's important is that it uses the <a target="_blank" href="http://www.prototypejs.org">prototypeJS</a> library. Be sure to integrate it when using the FormWalker.</p>
<p><strong>Usage:</strong> Just mark all your input fields with the CSS class "next" and the user will be able to "walk" through them (If the last field is reached the first field will be activated. so its kinda loop...). All other fields won't be touched by the script:</p>
<div class="igBar"><span id="lhtml-20"><a href="#" onclick="javascript:showCodeTxt('html-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-20">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"next"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>btw for all who dont know: it is possible to use more than one classname, just in case you need your own css class additionally. That would look like this somehow:
<div class="igBar"><span id="lhtml-21"><a href="#" onclick="javascript:showCodeTxt('html-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-21">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"myFreakyClass next"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>At the end of your form you load the FormWalker which will do all the stuff for you (attach the necessary events, etc)</p>
<div class="igBar"><span id="ljavascript-22"><a href="#" onclick="javascript:showCodeTxt('javascript-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-22">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">/****</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">FormWalker - walk form fields using the enter key by just adding the css class &quot;next&quot;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">to each field which should be &quot;walkable&quot;.</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">Michal Gabrukiewicz (FFTUIL - feel free to use it License)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">****/</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> FormWalker<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FormWalker.<span style="color: #006600;">jumpNext</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">nextElement</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>window.<span style="color: #006600;">event</span><span style="color: #66cc66;">&#41;</span> ? window.<span style="color: #006600;">event</span>.<span style="color: #006600;">keyCode</span> : e.<span style="color: #006600;">keyCode</span><span style="color: #66cc66;">&#41;</span> == Event.<span style="color: #006600;">KEY_RETURN</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">nextElement</span>.<span style="color: #006600;">activate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FormWalker.<span style="color: #006600;">load</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; nexts = document.<span style="color: #006600;">getElementsByClassName</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'next'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> prev = <span style="color: #003366; font-weight: bold;">null</span>;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #CC0000;color:#800000;">0</span>; i &lt;nexts.<span style="color: #006600;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; it = nexts<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>prev<span style="color: #66cc66;">&#41;</span> prev.<span style="color: #006600;">nextElement</span> = it;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>i == nexts.<span style="color: #006600;">length</span> - <span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> it.<span style="color: #006600;">nextElement</span> = nexts<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; it.<span style="color: #006600;">onkeydown</span> = FormWalker.<span style="color: #006600;">jumpNext</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; prev = it;</div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FormWalker.<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>I have tested it in IE 6 and Firefox 2. Works fine for me...</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.webdevbros.net/2007/04/16/formwalker-walking-through-form-fields-with-the-enter-key/&amp;t=FormWalker+-+walking+through+form+fields+with+the+enter+key&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.webdevbros.net/2007/04/16/formwalker-walking-through-form-fields-with-the-enter-key/&amp;title=FormWalker+-+walking+through+form+fields+with+the+enter+key&amp;t=2 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.webdevbros.net/2007/04/16/formwalker-walking-through-form-fields-with-the-enter-key/&amp;title=FormWalker+-+walking+through+form+fields+with+the+enter+key&amp;t=1 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=FormWalker+-+walking+through+form+fields+with+the+enter+key;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=square></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.webdevbros.net/2007/04/16/formwalker-walking-through-form-fields-with-the-enter-key/'; tweetmeme_style = 'normal';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.webdevbros.net/2007/04/16/formwalker-walking-through-form-fields-with-the-enter-key/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
