<?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>Michael Sync &#187; JavaScript</title>
	<atom:link href="http://michaelsync.net/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://michaelsync.net</link>
	<description>Sharing our knowledge</description>
	<lastBuildDate>Thu, 05 Apr 2012 07:37:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Open Source Simple Twitter Client written in Javascrip (Titanium)</title>
		<link>http://michaelsync.net/2011/11/04/open-source-simple-twitter-client-written-in-javascrip-titanium</link>
		<comments>http://michaelsync.net/2011/11/04/open-source-simple-twitter-client-written-in-javascrip-titanium#comments</comments>
		<pubDate>Fri, 04 Nov 2011 09:51:27 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/?p=1897</guid>
		<description><![CDATA[Guys! Here is simple twitter client (with very limited functionality) which I created as a final assignment for &#8220;Mobile Module&#8221; at USQ. This whole application is written in Javascript on Titanium platform which allows us to create &#8220;Android app&#8221;, &#8220;iPhone app&#8221;...]]></description>
			<content:encoded><![CDATA[<p>Guys! Here is simple twitter client (with very limited functionality) which I created as a final assignment for &#8220;Mobile Module&#8221; at <a href="http://www.usq.edu.au/">USQ</a>. This whole application is written in Javascript on <a href="http://www.appcelerator.com/products/">Titanium platform</a> which allows us to create &#8220;Android app&#8221;, &#8220;iPhone app&#8221; and &#8220;BlackBerry app&#8221; by using only one language &#8220;Javascript&#8221;. You can get the full source code from this Git repository.</p>
<ul>
<li><strong>Git URL</strong> : <a href="https://github.com/michaelsync/USQTweet">https://github.com/michaelsync/USQTweet</a></li>
<li>Help Viewer: <a href="http://michaelsync.net/usqtweet/help/">http://michaelsync.net/usqtweet/help/</a></li>
</ul>
<h1>USQTweet – Simple Twitter App</h1>
<h2>Description</h2>
<p>USQTweet is a simple tweet client application that is created for Mobile Module in USQ. You can use this application to view the latest tweet posted by you and people that you are following on your Android phone.</p>
<p><img class="alignnone size-full wp-image-1898" title="USQ Tweet" src="http://michaelsync.net/wp-content/uploads/2011/11/USQ-Tweet.png" alt="" width="561" height="277" /></p>
<h2>Features</h2>
<ul>
<li>Login with existing twitter account</li>
<li>View the latest tweets on mobile phone</li>
</ul>
<div>As I mentioned, there is only two features in this application. You can use this application as a sample for oauth authentication with twitter.<strong> I tried to add the &#8220;posting new status&#8221; feature as well but it didn&#8217;t work for some reasons. I posted about <a href="http://stackoverflow.com/questions/7944759/posting-new-status-to-twitter-from-android-emulator-is-giving-me-error">this issue in this forum</a>. Please let me know if you have any solution for this problem</strong>.</div>
<h2></h2>
<h2>Technical</h2>
<ul>
<li>oAuth 1.0</li>
<li>Network I/O</li>
<li>Dual orientation GUI</li>
<li>File API: Persistent storage using File ( &#8220;Isolated storage&#8221; style)</li>
<li>Web View for Twitter authentication process (oAuth) and help file viewer</li>
<li>Rail-style naming conventing.</li>
<li>Comment style : <a href="http://developer.yahoo.com/yui/yuidoc/">YUI Doc</a></li>
<li>Titanium (I&#8217;m using 1.2)</li>
<li>Android SDK</li>
</ul>
<p><strong>Requirements</strong></p>
<ul>
<li>This application needs live internet connection.</li>
<li>You need to have an existing twitter account. (Note to Examiners: I emailed my twitter account details to my teacher &#8220;Stijn Dekeyser&#8221;. If you don&#8217;t have an existing twitter account and don&#8217;t want to create new one then you can get my account from Mr-Dekeyser. Please don&#8217;t share with other.</li>
</ul>
<h2>Known issues</h2>
<ul>
<li>If there is some errors in connection or etc, the application won&#8217;t let the users know about the problem. You will have to check the debug log in Titanium Console manully and will need to restart the application.</li>
<li>If you close the web view popup, there is no way to re-open it so you will have to re-run the application.</li>
<li>WebView is just a small browser in application but it&#8217;s not so easy to nevigate so it&#8217;s better not to click other links.</li>
<li>Additional to #1, there is no global exception handling. 5.</li>
<li>The application will store the access token once you authorized the application. So, it will not ask you to enter username/pwd or authorize again later. But the problem is that when you revoke the access from twitter site but you will have the access token that you have saved earlier in device then you will get the error. You need to clear the application data.</li>
<li>access token should not be stored in plain format.</li>
<li>If your tweet is so long then you won&#8217;t be able to see the completed text on the screen. I tried positing the text and alignment but using height:&#8217;auto&#8217; in one control and specific height in another control doesn&#8217;t work well in Titanium.</li>
<li>You won&#8217;t be able to post anything to twitter as well. I posted about this in forum but I haven&#8217;t received any reply on this yet.</li>
</ul>
<h2>Reference ~</h2>
<ul>
<li>Using OAuth 1.0a (<a href="https://dev.twitter.com/docs/auth/oauth">https://dev.twitter.com/docs/auth/oauth</a>)</li>
<li>Twitter REST API (<a href="https://dev.twitter.com/docs/api">https://dev.twitter.com/docs/api</a>)</li>
<li>John Kristian&#8217;s Javascript Library (<a href="http://oauth.googlecode.com/svn/code/javascript/">http://oauth.googlecode.com/svn/code/javascript/</a>) Note: I&#8217;m using sha1.js and oauth.js from his library.</li>
<li>oauth-adapter (<a href="http://code.google.com/p/oauth-adapter/">http://code.google.com/p/oauth-adapter/</a>) Note: I didn&#8217;t use this library but I looked at the code to understand how things works.</li>
</ul>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2011/11/04/open-source-simple-twitter-client-written-in-javascrip-titanium&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2011/11/04/open-source-simple-twitter-client-written-in-javascrip-titanium/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Download Flash file with RealPlayer</title>
		<link>http://michaelsync.net/2008/02/24/download-flash-file-with-realplayer</link>
		<comments>http://michaelsync.net/2008/02/24/download-flash-file-with-realplayer#comments</comments>
		<pubDate>Sun, 24 Feb 2008 17:08:50 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2008/02/24/download-flash-file-with-realplayer</guid>
		<description><![CDATA[I wrote about how to download Flash file using Download Helper, the firefox addon, long time back. but I didn&#8217;t use that much since it doesn&#8217;t support some of my video sites that I want to download. Recently, I downloaded...]]></description>
			<content:encoded><![CDATA[<p>I wrote about <a href="http://michaelsync.net/2006/11/20/downloading-flash-file-using-downloadhelper">how to download Flash file using Download Helper</a>, the firefox addon, long time back. but I didn&#8217;t use that much since it doesn&#8217;t support some of my video sites that I want to download.</p>
<p>Recently, I downloaded the latest version of <a href="http://www.real.com.au/?country=apac&amp;language=en&amp;src=apac_home&amp;rsrc=">RealPlayer</a> and subscribed the Superpass with unlimited access. I found that Realplayer is not only a powerful player but also the downloader that can download the movie (flash version) from any website with just one click. I think Realplayer is pretty impressive. I&#8217;m kinda like it.</p>
<p>Okay, back to the topic, I will tell you how to download the flash movie using Realplayer..</p>
<p>How-to?</p>
<ul>
<li>Go to any movie website that you like.</li>
<li>Move  over the movie object then &#8220;Download This Video&#8221; link will be shown at the top-right side of media player.</li>
<li>Click on this link</li>
</ul>
<p><img src="http://michaelsync.net/wp-content/uploads/2008/02/realplayer-download-this-video.jpg" alt="RealPlayer Download This Video" /></p>
<ul>
<li>RealPlayer Download and Recording Manager will be shown as the picture below.</li>
</ul>
<p><img src="http://michaelsync.net/wp-content/uploads/2008/02/realplayer-download-and-recording-manager.jpg" alt="RealPlayer Download and Recording Manager" /></p>
<ul>
<li>It will take some time depend on the internet connection that you use and other configurations.</li>
<li>If the downloading is completed, &#8220;Play&#8221; and &#8220;Remove&#8221; link will be shown. If you want to play the video, just click &#8220;Play&#8221; link at the right-side of RP D&amp;R manager.</li>
</ul>
<p><img src="http://michaelsync.net/wp-content/uploads/2008/02/realplayer-download-complete.jpg" alt="RealPlayer Download Complete" /></p>
<ul>
<li> Realplayer will be opened and you can watch the video that you have downloaded. That&#8217;s all. Cool, isn&#8217;t it?</li>
</ul>
<p><img src="http://michaelsync.net/wp-content/uploads/2008/02/realplayer-open-in-realplayer.jpg" alt="RealPlayer Open in Realplayer" /></p>
<p>You can find those downloaded videos under this path &#8220;C:\Users\(<em>Your User Name</em>)\Videos\RealPlayer Downloads\&#8221;. And also, you are able to change the path as you like in &#8220;Preferences&#8221; dialog of Realplayer.</p>
<p>I hope you are gonna like it. :) btw, Real Online Movie Library is not that good (at least for me) . I was looking for something like that but the problem is that they are not able to add new movies (not episode or TV-series) in their library. So, the idea for opening online movie library with low subscription fees is good but they can&#8217;t effort to make this happen until now.</p>
<p><strong>Related ~</strong></p>
<ul>
<li><a href="http://michaelsync.net/2006/11/20/downloading-flash-file-using-downloadhelper">Downloading Flash File using DownloadHelper</a></li>
</ul>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2008/02/24/download-flash-file-with-realplayer&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2008/02/24/download-flash-file-with-realplayer/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Script# &#8211; Is Script# right for you?</title>
		<link>http://michaelsync.net/2007/11/25/script-is-script-right-for-you</link>
		<comments>http://michaelsync.net/2007/11/25/script-is-script-right-for-you#comments</comments>
		<pubDate>Sun, 25 Nov 2007 17:22:06 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/11/25/script-is-script-right-for-you</guid>
		<description><![CDATA[I was playing a lit bit with Script# and I have some thoughts that I wanna share you. ( If you have no idea about what Script# is then you can read this post &#8220;Script#: C# to Javascript converter[^] &#8220;....]]></description>
			<content:encoded><![CDATA[<p>I was playing a lit bit with Script# and I have some thoughts that I wanna share you.  ( If you have no idea about what Script# is then you can read this post &#8220;<a href="http://michaelsync.net/2007/10/29/script-c-to-javascript-converter">Script#: C# to Javascript converter</a>[<a href="http://michaelsync.net/2007/10/29/script-c-to-javascript-converter" target="_blank">^</a>] &#8220;.  )  I know that Script# is a great framework but it might not be right for all ASP.NET developers. The reason is that there are a few things which are not so convenience for me while I&#8217;m using Script#. But I don&#8217;t want to say that this framework is not for you. maybe, you might like it. In fact, I will give some facts that I&#8217;ve learnt about Script#. You decide whether Script# is right for you or not.</p>
<p>Contents</p>
<ol>
<li>Script#&#8217;s features</li>
<li>Writing the object-oriented code with Script#</li>
<li>Tools for generating the documentation and compressing the sourcecode</li>
<li>What we meant by Script# as a C# to Javascript Converter is ~</li>
<li>Script# as a new language</li>
<li>Debugging problem in Script#</li>
<li>Script# is not from Microsoft</li>
<li>Script# is not Opensource</li>
<li>Using the thirt-party Javascript library in Script#</li>
<li>Script# for ASP.NET Ajax developers and Vista Gadget developers</li>
</ol>
<h3>1. Script#&#8217;s features</h3>
<p>Script# supports the compile-time checking, intelliSense, class-viewer, reflection and etc. It helps you not to have any typo-errors (e.g. calling foo&#8217;() instead of foo();  foo(arg1, arg2) instead of foo(arg1); ) that the most of Javascript developers used to make. So, the benefit of using Script# is that it will improve your productivity.</p>
<p><img src="http://michaelsync.net/wp-content/uploads/2007/11/intellisense.jpg" alt="intellisense.jpg" /><em><br />
Fig: intelliSense<br />
</em><br />
<img src="http://michaelsync.net/wp-content/uploads/2007/11/tooltip.jpg" alt="tooltip.jpg" /><br />
<em>Fig: Tooltip<br />
</em><br />
<img src="http://michaelsync.net/wp-content/uploads/2007/11/compile-time-validation.gif" alt="Script# - Compile-time Validation" /><br />
<em>Fig: Compile-time validation</em></p>
<h3>2. Writing the object-oriented code with Script#</h3>
<p>Writing the object-oriented Javascript become so easy with Script#. As you know, writing the object-oriented code in Javascript and C# are quite different. If you are not so familiar with Javascript, you probably need to find the reference when you need to write the code with object-oriented concept. Now, it&#8217;s over. You can just write the object-oriented code in C# and Script# will convert this code to the object-oriented Javascript code.</p>
<h3>3. Tools for generating the documentation and compressing the sourcecode</h3>
<p>If you are using Script#, you won&#8217;t need any third-party tool (e.g. JSDoc, Javascript Compressor) for generating the documentation or compressing your javascript library. Script# already has the build-in feature for that purpose.</p>
<h3>4. What we meant by Script# as a C# to Javascript Converter is ~</h3>
<p>This is very important thing you need to understand before you start learning about Script#. As I said in <a href="http://michaelsync.net/2007/10/29/script-c-to-javascript-converter" title="Script#: C# to Javascript Converter">my previous article</a>, Script# is able to convert the C# code to Javascript. But it doesn&#8217;t mean that it can convert all C# code that you wrote in winform or webform. In order to convert the C# to Javascript via Script#, you have to write the Script#-specific code in C# then those codes will be converted to Javascript&#8230;</p>
<h3>5. Script# as a new language</h3>
<p>The syntax of Script# is not so similiar to the Javascript&#8217;s syntax. So, I feel like learning a new language to write the Javascript. Another problem is that it is so hard to find the equivalent syntax in Script#.</p>
<p>For example: <a href="http://projects.nikhilk.net/Lists/Discussion/Threaded.aspx?RootFolder=%2fLists%2fDiscussion%2fHow%20to%20access%20%27document%27%20of%20created%20DOMElement&amp;FolderCTID=0x0120020088F5CDA3C6DA554CB2098DAAD95802EA&amp;TopicsView=http%3A%2F%2Fprojects%2Enikhilk%2Enet%2FLists%2FDiscussion%2FScript%2520Discussions%2Easpx">How to access &#8216;document&#8217; of created DOMElement??</a>[<a href="http://projects.nikhilk.net/Lists/Discussion/Threaded.aspx?RootFolder=%2fLists%2fDiscussion%2fHow%20to%20access%20%27document%27%20of%20created%20DOMElement&amp;FolderCTID=0x0120020088F5CDA3C6DA554CB2098DAAD95802EA&amp;TopicsView=http%3A%2F%2Fprojects%2Enikhilk%2Enet%2FLists%2FDiscussion%2FScript%2520Discussions%2Easpx" target="_blank">^</a>]</p>
<p>In Javascript,</p>
<pre class="brush: jscript; title: ; notranslate">
var iframe = document.createElement(&quot;iframe&quot;);
var doc = iframe.contentWindow.document;
</pre>
<p>In Script#,</p>
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.DHTML;
using ScriptFX;
using ScriptFX.UI;

public class MyScriptlet {

public static void Main(ScriptletArguments arguments) {
DOMElement _iframe = Document.CreateElement(&quot;iframe&quot;);
DOMElementExt contentWindowElement = (DOMElementExt)_iframe.GetAttribute(&quot;contentWindow&quot;);
DOMElement doc = contentWindowElement.document;

}
}

[IgnoreNamespace]
[Imported]
public class DOMElementExt : DOMElement {

[IntrinsicProperty]
public DOMElement document {
get { return null; }
}

[IntrinsicProperty]
public DOMElement body {
get { return null; }
}

[IntrinsicProperty]
public DOMElement src {
get { return null; }
}

[IntrinsicProperty]
public DOMElement firstChild {
get { return null; }
}
}
</pre>
<p>If you look at both examples, you will understand how hard to find the equivalent syntax in Script#. It&#8217;s okay if we can find the equivalent one. But what if Script# doesn&#8217;t support something that can be done with Javascript?</p>
<h3>6. Debugging problem in Script#</h3>
<p>Script# does support the compile-time validation but the problem is that you won&#8217;t be able to debug the C# code that you wrote. Instead, you will have to debug the Javascript code that generate by Script#. I think that it is the big issue for web developer. I don&#8217;t feel comfortable to debug those generated code.</p>
<h3>7. Script# is not from Microsoft</h3>
<p>Script# is not developed by Microsoft while the GWT is developed by Google. It has too much differences. Even thought Nikhil is an architect from Microsoft, Script# is just one of his pet projects.. So, I don&#8217;t think that he is gonna support his pet project all the time.. And I&#8217;m not so sure that Nikhil will add more features to this project or not..</p>
<h3>8. Script# is not Opensource</h3>
<p>Script# is not an opensource project. Actually, it&#8217;s absolutely okay for me to use the non-opensource projects (I&#8217;ve been using the Visual Studio since long long ago.) but there should be a group of people who are supporting this project, right? What if we need the bug-fixed?</p>
<h3>9. Using the thirt-party Javascript library in Script#</h3>
<p>The most of Javascript libraries /framework (e.g. <a href="http://www.prototypejs.org/">prototype</a>, <a href="http://script.aculo.us/">script.aculo.us</a>, <a href="http://developer.yahoo.com/yui/">Yahoo.UI</a>, <a href="http://extjs.com/">ExtJS</a>) are not written in Script#. So, you can&#8217;t use those libraries right away from your Script# code. I think you will have to create a wrapper class for those libraries in order to use them in your Script#-enabled projects.</p>
<h3>10. Script# for ASP.NET Ajax developers and Vista Gadget developers</h3>
<p>I think that Script# might be good for ASP.NET Ajax developers and Vista Gadget developers. As I&#8217;m not very familiar with those things, I&#8217;m not able to cover about this. I need your contributes for this fact.</p>
<p>Okay That&#8217;s all from my side. Feel free to let me know if you have any thought or comment. Thanks.
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/11/25/script-is-script-right-for-you&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/11/25/script-is-script-right-for-you/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to protect the image from being copied?</title>
		<link>http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied</link>
		<comments>http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied#comments</comments>
		<pubDate>Wed, 22 Aug 2007 17:40:03 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied</guid>
		<description><![CDATA[Well, it is so sad to say that there is no way to protect the images from being copied until the time of writing this post. You may probably tell me that you found a lot of &#8220;Image Protection&#8221; tools...]]></description>
			<content:encoded><![CDATA[<p>Well, <strong>it is so sad to say that there is no way to protect the images from being copied</strong> until the time of writing this post. You may probably tell me that you found a lot of &#8220;Image Protection&#8221; tools on web. Yeah. I know. I did even tried some of them once. Those tools make people difficult to copy the images from your website. but there are always some sort of hecks for copying images. No matter what tools or technologies you use.</p>
<p>I will tell some attempts that people tried to achieve this goal and the reason why those attempts were failed.</p>
<p><strong>#1. Disabling &#8220;Right Click&#8221; on webpage by using Javascript.</strong></p>
<p>This is very very old trick and it&#8217;s totally useless. Don&#8217;t forget &#8220;Save As&#8221; in File menu. Plus, there are a lot of DOM manipulators (eg: Firebug) to track the path of images.</p>
<p><strong>#2. Adding new transparent image over the actual image  </strong></p>
<p>I found some sites (including flickr) that are using this technique to protect their images from being copied. It works for normal users who only knows &#8220;Right Click&#8221; and &#8220;Save Image As&#8221;. You can still check the source to get the correct path of actual image that you want. If you are familiar with firebug, you can easily delete the transparent image that you don&#8217;t want on the fly.</p>
<p><strong>#3.  Using third-part tools for image protection</strong></p>
<p>If you do googling about this a lit bit, you will get a ton of tools advertising that those tools will help you to protect your image from being copied (some even said that those tools are able to protect HTML code too.) Don&#8217;t even never spend your money on those tools. I mean it. As I said above, I tried already. I know those tools are not good enough since they have their own limitations. So, don&#8217;t waste your money on it.</p>
<p>This fact applied for code protection tool also. Those tools are going to encrypt your webpage and will add a lot of whitespace in your actual source. So, if you check the &#8220;View Source&#8221; a lit in your browser, you will see plain text or some text you write instead of HTML code. but don&#8217;t forget to scroll a lit bit.. You will see goddammed things.. and those tools will eat your bandwidth and it made your visitors to view the web page in slow motion. :)</p>
<p><strong>#4. Putting images in Embedded Object (Flash or ActiveX Object)</strong></p>
<p>I think this is the best way to protect the image so far.  but it is possible to download the whole flash file (*.flv) to local machine by using third-party tool or firefox extensions (eg: Download Helper). So, the individual image are safe from being copied but not for flash.</p>
<p><strong>UPDATED (27th August, 2007):  </strong></p>
<p><strong>Watermarking </strong>(Thanks to <strong>mmhan</strong> for reminding me about this.)<strong><br />
</strong></p>
<p>AFAIK, there are two ways of watermarking. The first way is that putting a watermark simply on the image. This watermark will be visible to everybody. The second way is that putting a invisible watermark on the image by using Steganography.</p>
<p>Yeah. those are the ways that I remember how people tried to protect their images. If you have other ways, don&#8217;t hesitate to let me know.</p>
<p>Remember! All images from the webpage are already sent to the temporary internet files of  user&#8217;s local machine before showing to the web browser. So, user can still copying images from Temporary Internet File folder. And, What about &#8220;Print Screen&#8221;? :)</p>
<p>So, if you ask me how to protect the image, I would say &#8220;don&#8217;t do that!&#8221; . :)
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/08/22/how-to-protect-the-image-from-being-copied/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>[Fun] Playing with Javascript</title>
		<link>http://michaelsync.net/2007/02/28/fun-playing-with-javascript</link>
		<comments>http://michaelsync.net/2007/02/28/fun-playing-with-javascript#comments</comments>
		<pubDate>Wed, 28 Feb 2007 10:49:43 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/02/28/fun-playing-with-javascript</guid>
		<description><![CDATA[Download: http://michaelsync.net/demo/Funny-Javascript.txt Fun #1: Go to any website (eg: Google Personalized HomePage) Delete everything in the address bar paste the following code in the address bar: Press enter and have fun! :) Thanks to Grim. Fun #2: Go to Google...]]></description>
			<content:encoded><![CDATA[<p><strong>Download</strong>: http://michaelsync.net/demo/Funny-Javascript.txt</p>
<p><img src='http://michaelsync.net/wp-content/uploads/2007/10/laught.jpg' alt='' /></p>
<p><strong>Fun #1: </strong></p>
<ol>
<li>Go to any website (eg: <a href="http://www.google.com/ig?hl=en">Google Personalized HomePage</a>)</li>
<li>Delete everything in the address bar</li>
<li>paste the following code in the address bar:
<pre class="brush: jscript; title: ; notranslate">
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300;
y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0;
i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5;
DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);
</pre>
</li>
<li>Press enter and have fun! :)</li>
</ol>
<p><em>Thanks to <a href="http://www.destructoid.com/forum/viewtopic.php?t=1271">Grim</a>.</em></p>
<p><strong>Fun #2: </strong></p>
<ol>
<li>Go to Google Classic Homepage (*NOT Personalized Home.*)</a>)</li>
<li>Delete everything in the address bar</li>
<li>paste the following code in the address bar:
<pre class="brush: jscript; title: ; notranslate">
javascript:i=100;void(setInterval(&amp;quot;i++;document.images[1].width=i&amp;quot;,5),setInterval(&amp;quot;i++;document.images[1].height=i&amp;quot;,5),setInterval(&amp;quot;i++;document.images[2].width=i&amp;quot;,5),setInterval(&amp;quot;i++;document.images[2].height=i&amp;quot;,5),setInterval(&amp;quot;i++;document.images[3].width=i&amp;quot;,5),setInterval(&amp;quot;i++;document.images[3].height=i&amp;quot;,5),setInterval(&amp;quot;i++;document.images[4].width=i&amp;quot;,5)
,setInterval(&amp;quot;i++;document.images[4].height=i&amp;quot;,5) )
</pre>
</li>
<li>Press Enter</li>
</ol>
<p><em>Thanks to Harpreet and Philip(Ye Maung).</em></p>
<p><strong>Fun #3: </strong></p>
<ol>
<li>Launch Internet Explorer</li>
<li>Delete everything in the address bar</li>
<li>paste the following code in the address bar:
<pre class="brush: jscript; title: ; notranslate">
javascript:function flood(n) {if (self.moveBy) {for (i = 15; i &amp;gt; 0;i--){for
(j = n; j &amp;gt; 0; j--){self.moveBy(1,i);self.moveBy(i,0);self.moveBy(0,-i);self.moveBy(-i,0);
} } }}flood(6);{ var inp = &amp;quot;MIKE morf ,ecnavda ni RAEY WEN YPPAH ,iH&amp;quot;; var outp
= &amp;quot;&amp;quot;; for (i = 0; i &amp;lt;= inp.length; i++) {outp =inp.charAt (i) + outp ; }
alert(outp) ;}; reverse
</pre>
</li>
<li>Press Enter</li>
</ol>
<p><em>Thanks to the author of <a href="http://americatopten.blogspot.com/2006/12/funny-stuff-with-javascript.html">this</a> post.</em></p>
<p><strong>Fun #4:  last but not least :) </strong></p>
<ol>
<li>Launch Internet Explorer</li>
<li>Delete everything in the address bar</li>
<li>paste the following code in the address bar:
<p>javascript:function reverse() { var inp = &quot; )-: krow ru no yrrac ko.mih morf<br />
nraeL .seod CNYS LEAHCIM ekil krow lufesu emos oD .esnesnon siht lla gniod rof<br />
uoy gniyap ton si ynapmoC&quot;; var outp = &quot;&quot;; for (i = 0; i &lt;= inp.length; i++) {<br />
outp = inp.charAt (i) + outp ; } alert(outp) ;}; reverse()</p>
</li>
<li>Press Enter</li>
</ol>
<p><em>Thanks to Eve for forwarding this code.</em></p>
<p>Cool.. isn&#8217;t it??<br />
Happy Coding! Njoy!! :)</p>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/02/28/fun-playing-with-javascript&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/02/28/fun-playing-with-javascript/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Resources for Object Oriented Javascript</title>
		<link>http://michaelsync.net/2007/01/07/resources-for-object-oriented-javascript</link>
		<comments>http://michaelsync.net/2007/01/07/resources-for-object-oriented-javascript#comments</comments>
		<pubDate>Sun, 07 Jan 2007 05:31:53 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/01/07/resources-for-object-oriented-javascript</guid>
		<description><![CDATA[Initially, I was thinking to write an article about Object Oriented Javascript in my blog. but when I checked what google says, I came to know that there are a lot of cool articles for it.. So, I decided to...]]></description>
			<content:encoded><![CDATA[<p>Initially, I was thinking to write an article about Object Oriented Javascript in my blog. but when I checked what <a href="http://www.google.com/search?hl=en&amp;q=javascript+object+oriented&amp;btnG=Google+Search">google says</a>,   I came to know that there are a lot of cool articles for it.. So, I decided to post only the useful links instead of writing the repeated article. Hopefully, you may find it useful..</p>
<p>  If you have any cool article related to this topic then please let me know. Thanks a lot.</p>
<p><strong>Resources ~</strong></p>
<ul>
<li><a href="http://www.codeproject.com/aspnet/JsOOP1.asp">Writing Object-Oriented JavaScript Part 1</a></li>
<li><a href="http://www.codeproject.com/aspnet/JsOOP2.asp">Writing Object-Oriented JavaScript Part 2</a></li>
<li><a href="http://www.codeproject.com/aspnet/JsOOP3.asp">Writing Object-Oriented JavaScript Part 3</a></li>
<li><a href="http://java.sun.com/javascript/ajaxinaction/Ajax_in_Action_ApB.html">AJAX in Action: Appendix B &#8211; JavaScript for Object-Oriented Programmers</a></li>
<li><a href="https://blueprints.dev.java.net/bpcatalog/conventions/javascript-recommendations.html">JavaScript Recommendations for AJAX Component Writers</a></li>
<li><a href="http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book111">Javascript Conventions</a></li>
<li><a href="http://www.sergiopereira.com/articles/advjs.html">Quick guide to somewhat advanced JavaScript</a></li>
<li><a href="http://thinkingandmaking.com/entries/63">Best Practices: Implementing javascript for rich internet applications</a></li>
</ul>
<p>Credits: Thanks to the original writers and <a href="http://www.javapassion.com/ajaxcodecamp">Sang Shin</a>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/01/07/resources-for-object-oriented-javascript&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/01/07/resources-for-object-oriented-javascript/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom Javascript Dialog</title>
		<link>http://michaelsync.net/2007/01/01/custom-javascript-dialog</link>
		<comments>http://michaelsync.net/2007/01/01/custom-javascript-dialog#comments</comments>
		<pubDate>Mon, 01 Jan 2007 16:53:28 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2007/01/01/custom-javascript-dialog</guid>
		<description><![CDATA[Screenshot Source Code : http://michaelsync.net/demo/ComfirmDialogTest.zip Introduction This article describe how to create a Custom Javascript Dialog in ASP.NET. And also, I&#8217;m gonna tell you about my experience that I got when I was implementing this dialog in my project. I&#8217;d...]]></description>
			<content:encoded><![CDATA[<p><strong>Screenshot</strong><br />
<img src="http://michaelsync.net/wp-content/uploads/2006/12/hot-2.PNG" alt="hot-2.PNG" /></p>
<p><strong>Source Code </strong> :  http://michaelsync.net/demo/ComfirmDialogTest.zip</p>
<h3>Introduction</h3>
<p>This article describe how to create a Custom Javascript Dialog in ASP.NET. And also, I&#8217;m gonna tell you about my experience that I got when I was implementing this dialog in my project.</p>
<p><em><strong>I&#8217;d highly recommend you to download my sample before reading</strong>.</em> There are two samples in Demo Project that you can download. The first example is for implementing Javascript Prompt in ASP.NET. Even thought using Javascript Prompt is not a big deal, you can learn how to communicate between the client-side (JS) variable and Server-side (C#) variable, how to register Javascript in Content Page and so on. The second one is the main sample for this article. This sample will show how to create a Custom Javascript Dialog in ASP.NET, some tricks and so on. All coding and issues are discussed in details very well in this article.</p>
<h3>What you should already known</h3>
<ul>
<li>ASP.NET 1.1 (C#) &#8211; esp: Page Template and DataGrid</li>
<li>Javascript and CSS</li>
</ul>
<h3>Understanding of Current Sytem</h3>
<p>There is one listing page in the sytem. This page allows the user to delete multiple records at a time. The user has to enter a comment for the reason why he/she wants to delete those records. It can be done very easily in ASP.NET by using DataGrid with checked boxes. ( plus one textbox for comment and one button for deleting)  Unfortunetly, our client is not happy with having one extra  textbox for filling a comment in this page cuz of some UI issues. They more perfer to have something like Javascript Popup window with nice UI in this page.</p>
<h3>Our Goals</h3>
<ol>
<li><strong>Showing Javascript Dialog</strong> : The Main Goal is that showing nice javascript dialog when the user click the &#8220;Delete&#8221; button. [Showing Popup in Javascript is not that difficult but we have other requirement too.].</li>
<li><strong>Handling the sequence of the events</strong> :Since we are already written the code for Deleting the records in Server-side, this code (C#) should be executed after executing the client-script.</li>
<li><strong>Accessing the client-side variable from Service-side</strong>, The comment text has to be accessible from Server-side code.</li>
</ol>
<p><strong>Javascript Prompts</strong></p>
<pre>
var str = prompt('Please Enter the comments!');</pre>
<p>&#8220;<strong>Prompt</strong>&#8221; is a build-in function in Javascript to show a window like that below picture. It&#8217;s extremely easy to use. Another advantage is that the Server-side won&#8217;t be executed as long as this prompt is showing. The Server-side will be executed ONLY if the user click &#8220;OK&#8221; or &#8220;Cancel&#8221; so that we don&#8217;t need to any trick or hack to pause the Server-side executing.</p>
<p><img src="http://michaelsync.net/files/2006/12/javascript-prompt.PNG" alt="javascript-prompt.PNG" /></p>
<p>Okay. Let&#8217;s start coding! (I&#8217;m gonna use the basepage class that I have used in <a href="http://michaelsync.net/2006/11/30/using-yahoouicalendar-in-pagetemplate-and-master-page-part-ii/">this</a> sample (zip file no #1).) Firstly, we write a Javascript function called &#8220;AskForComment&#8221; as below.<br />
Note that we have to check whether the user cancel the operation or not.</p>
<p>(Refer to Blue line. we are checking three condition in this line.</p>
<ol>
<li>(str == &#8221;) is checking whether the user fills anything or not. Actually, we should trim this variable.</li>
<li>( str == &#8216;undefined&#8217;) is also checking the same thing. only different is that &#8216;undefined&#8217; is the default value of prompt in IE.</li>
<li>( str == null) is checking whether the user click &#8220;Cancel&#8221; button or not.) If the user doesn&#8217;t fill anything or click &#8220;Cancel&#8221; then our function is gonna return &#8220;false&#8221;, which means there wont be any further execution.</li>
</ol>
<pre>
&lt;script language="javascript"&gt;
function AskForComment(){
  var str = prompt('Please Enter the comments!');
<font color="#0000ff">  if((str == '') || ( str == 'undefined') || ( str == null))</font>
    return <font color="#ff0000">false</font>;
  else{
    return <font color="#ff0000">true</font>;
  }
}&lt;/script&gt;</pre>
<p><strong>Accessing the Client-side variable (variable named &#8220;str&#8221; in this sample ) from Server-side Code</strong></p>
<p>Here, we have one problem in accessing the javascript variable called &#8220;str&#8221; from Server-side code. So, we need to have one inferface that can be accessible from both Client-side and Server-side. So, I decide to use a Hidden Field as an interface in this sample and named it &#8220;hiddenComment&#8221; and also change this HTML Hidden Control to Server side control by adding <strong>&#8220;runat=&#8221;server&#8221;</strong>. Now, we have a control that can be accessed from Javascript and Server-side script (C#).</p>
<p>The following changes (in blue color) we need to made in our Javascript for getting the object of Hidden Field. (Note that <strong>_ctl5_hiddenComment</strong> is the ClientID of Server-side Hidden Field.)</p>
<pre>
&lt;script language="javascript"&gt;
function AskForComment(){
  var str = prompt('Please Enter the comments!');
  if((str == '') || ( str == 'undefined') || ( str == null))
      return <font color="#ff0000">false</font>;
  else{
<font color="#0000ff">      document.forms['frmBase'].elements['_ctl5_hiddenComment'].value = str
      var obj = document.getElementById('_ctl5_hiddenComment');
      obj.value = str;</font>
      return <font color="#ff0000">true</font>;
  }
}&lt;/script&gt;</pre>
<p>We just finished writing the Javascript as above with the required feature. But I think that it&#8217;s better if we register this Javascript function in <strong>Page_PreRender</strong> event since the ClientId of Server-side Hidden Field might be changed anytime. (If you dont know how to register the Javascript Function in Page_PreRender Event, please take a look at <strong>SampleControl1.ascx</strong> in Sample Project. You will see the completed code in <strong>SampleControl1_PreRender</strong> Event.)</p>
<p>After that, there is only two things we need to do. First one is that we have to attach our Javascript Function in &#8220;Delete&#8221; button.</p>
<pre>btnDelete.Attributes.Add("onclick", "return AskForComment();");</pre>
<p><em>Note: &#8220;<strong>return</strong>&#8221; is very important here. Because we dont want any further execution in case the user click &#8220;Cancel&#8221;.<br />
</em></p>
<p>Then, the last thing is that we have to check whether we are able to get the value of Hidden Field in the Click Event of &#8220;Delete&#8221; Button.</p>
<pre>
private void btnDelete_Click(object sender, System.EventArgs e)
{
  Console.WriteLine(hiddenComment.Value);
}</pre>
<h4>Demo</h4>
<p>Please open the page called &#8220;Sample1.aspx&#8221; from my sample. Set the breakpoint at the Click event of &#8220;Delete&#8221; button. Then, run the web project.</p>
<p>There are one DataGrid with Checkboxes in this page &#8220;Sample1.aspx&#8221;. If you click the &#8220;Delete&#8221; button then the Javascript Prompt will be shown for asking the comment. Type something you want and click &#8220;OK&#8221; button. Then, the Click event of &#8220;Delete&#8221; button will be fired. Now, you can check the value of Hidden Field &#8220;hiddenComment&#8221;. You will get the text that you type in Prompt.</p>
<p>*** Note: I didn&#8217;t use any database for the data that suppose to be in DataGrid. I have created two classes called &#8220;Person&#8221; and &#8220;Persons&#8221; in this sample. and All data from Persons class will be binded to DataGrid.</p>
<p>In the Click Event of &#8220;Delete&#8221; button, I didn&#8217;t put anything related to Database. But you will find the code for getting the value of hidden field and getting the selected item of DataGrid.</p>
<p>Okay. We have just done. But the main disadvantage that I really don&#8217;t like is that it doesn&#8217;t look good. It looks very different from the existing UI of our current system. So, We will think about other way.</p>
<h3>Custom Javascript Dialog</h3>
<p><img src="http://michaelsync.net/wp-content/uploads/2006/12/js-dialog.PNG" alt="js-dialog.PNG" /></p>
<p>As you all know, there are a lot of <a href="http://michaelsync.net/2006/07/26/opensouce-kids-xbox/">Opensource Javascript **box</a> in Internet. They all have their pros and cons. Some Javascript Libraries or toolkits have a lot of features such as Ajax support, DOM, Animation, Drag and Drop and so on. but they are not Light weight. In our sample, we just need to create one Custom Javascript Dialog . We dont any other features and we dont wanna load a ton of javascript objects (which won&#8217;t be used anyway) in web broswer.</p>
<p>So, I&#8217;m just going though the source code of Javascript Toolkit and I come to know that <a href="http://jquery.com/blog/2006/02/10/greybox-redux/">Greybox Redux</a> is pretty good toolkit and has very sample implementation.</p>
<p>but one thing I don&#8217;t like is that this toolkit is using IFrame. As IFrame is using in it, we might properly need to have one extra page to show in IFrame. However, we don&#8217;t like to have one extra page in our System. So, I decide to use HTML Table instead of IFrame since I don&#8217;t need to show anything dynamic on this dialog.</p>
<p>Okay. Let&#8217;s start!</p>
<p><strong>Creating HTML Window</strong></p>
<p>Before we start creating a custom dialog dynamically, we should start creating a static dialog in HTML.</p>
<p><strong>In Head Tag</strong> ~</p>
<pre>
#GB_window {   top: 10px;   left: 0px;   position: absolute;   background: #fff;   border: 5px solid #aaa;   overflow: auto;   width: 410px;   height: 158px;   z-index: 150; }

#GB_caption {   font: 12px bold helvetica, verdana, sans-serif;   color: #fff;   background: #888;   padding: 2px 0 2px 5px;   margin: 0;   text-align: left; }

#GB_window img {   position: absolute;   top: 2px;   right: 5px;   cursor: pointer;   cursor: hand; }</pre>
<p><strong>In Body Tag</strong> ~</p>
<pre>

<font color="#0000ff">&lt;div id='GB_window'&gt;</font>
<font color="#ff9933">&lt;div id='GB_caption'&gt;Confirm Dialog&lt;/div&gt;</font>
<font color="#ff00ff">&lt;img src='close.gif' alt='Close window' '/&gt;</font>
<font color="#008000">&lt;div id='definition'&gt;</font>
&lt;table border='0' width='400' height='130' cellspacing='0' cellpadding='0'
ID='Table1'&gt;
&lt;tr&gt;
&lt;td height='23' width='18'&gt; &lt;/td&gt;
&lt;td height='23' width='446'&gt; &lt;/td&gt;
&lt;td height='23' width='31'&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height='24' width='18'&gt; &lt;/td&gt;
&lt;td height='24' width='446'&gt;&lt;font face='Verdana' size='2'&gt;Please fill
the reason for deleting records!&lt;/font&gt;&lt;/td&gt;
&lt;td height='24' width='31'&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height='23' width='18'&gt; &lt;/td&gt;
&lt;td height='23' width='446'&gt;&lt;input type='text' name='T2' size='57'
ID='Text1'&gt;&lt;/td&gt;
&lt;td height='23' width='31'&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height='23' width='18'&gt; &lt;/td&gt;
&lt;td height='23' width='446'&gt;
&lt;input type='button' value='Delete It!' name='B4' ID='Button1' &gt;&lt;/td&gt;
&lt;td height='23' width='31'&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height='23' width='18'&gt; &lt;/td&gt;
&lt;td height='23' width='446'&gt; &lt;/td&gt;
&lt;td height='23' width='31'&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
<font color="#008000">&lt;/div&gt;</font>

<font color="#0000ff">&lt;/div&gt;</font></pre>
<p>Output will be as following image.</p>
<p><img src="http://michaelsync.net/files/2007/01/dialog-output.PNG" alt="dialog-output.PNG" /></p>
<p>Note:</p>
<ol>
<li>DIV &#8220;<strong>GB_Window</strong>&#8221; and CSS &#8220;<strong>#GB_window</strong>&#8221; is for base dialog.</li>
<li>DIV &#8220;<strong>GB_caption</strong>&#8221; and CSS &#8220;<strong>#GB_caption</strong>&#8221; is for the Caption of Dialog. For example: if you wanna have &#8220;blue color&#8221; (instead of &#8220;grey color&#8221;) for the background of capture, you can simply change the color value in CSS of <strong>#GB_caption.</strong></li>
<li>CSS <strong>#GB_window img</strong> is for &#8220;Close&#8221; image that you can replace with any picture. The current image is not the original image of Grey Redux. I made it a lit bit smaller.</li>
<li>All tags within the div &#8220;<strong>definition</strong>&#8221; are the content of dialog. For example, if you dont want one text, one textbox and button to show in dialog, you can replace with anything you want.</li>
</ol>
<p><strong>Implementing Custom Javascript Dialog in ASP.NET</strong></p>
<p>Please open the HTML View of <strong>TestContentPageControl.ascx</strong> from the sample project that you downloaded. (As there are a lot of code in this page, I won&#8217;t paste all coding here.)</p>
<p>There is one div called &#8220;div1&#8243;. This is a placeholder where our Custom Javascript Dialog suppose to be displayed. ( As I wanna use &#8220;InnerHTML&#8221; instead of using &#8220;HTML DOM&#8221;, you put this div in this page. ) You may notice that the style of this DIV.</p>
<ol>
<li>DISPLAY: none;    This DIV should not show until the user click the &#8220;Delete&#8221; button.</li>
<li>Z-INDEX: 111;    If there are other controls placed on your page, you should set the highest value of this style. otherwise, the custom  dialog will be shown behind the other controls.</li>
<li>POSITION: absolute;   this is a must since we wanna show the dialog at the center of page</li>
</ol>
<p>You may also find the hidden input called &#8220;hiddenComment&#8221; in TestContentPageControl.ascx. The main thing is that this control has to be a Server-side control. So, both client-side script (js) and  server-side script (C#) are able to access this control. (I already explain about the use of Server-side Hidden Field earlier.)</p>
<p>After viewing the HTML view of ascx file, we should go and check the PreRender event of page &#8220;TestContentPageControl_PreRender&#8221;.</p>
<p>There are three javascript functions (hideWindow(), showWindow() and deleteit())  in this event. (You may notice the variable called g_IsWindowShown in this event. I will explain about it later. For the time being, we will just focos on showing and hiding the JS dialog.)</p>
<p><strong>Understanding of hideWindow() Javascript Function</strong></p>
<p>This function is very simple. When the user click &#8220;close&#8221; image or &#8220;cancel&#8221; button then we set the &#8220;Display&#8221; style of div1 to &#8220;none&#8221;.</p>
<p><strong>Understanding of showWindow() Javascript Function</strong></p>
<p>The following lines is used for getting the clientWidth and setting the dialog at the center of the page.</p>
<pre>
var w = self.innerWidth || (de&amp;&amp;de.clientWidth) || document.body.clientWidth;
var oDiv = document.getElementById('div1');
oDiv.style.left = ((w - 410)/2) + 'px';</pre>
<p>Then, we declare the variable called <strong>str </strong>in this function and we will append the HTML code ( that I show in &#8220;<strong>Creating HTML Window</strong>&#8221; ) to this variable.</p>
<p>After that, we set this varible to the inner text of div1. (oDiv.innerHTML = strWin;) then, we show this DIV in browser.</p>
<p>Here, we have one problem. After showing our Javascript Dialog, the execute goes to the Server-side. (It is not like that Javascript Prompt. When we are using Javascript Prompt, the execution is paused as long as this prompt is showing.) So, we need some tricks for pausing the execution and re-running the execution.</p>
<h4>Trick #1</h4>
<p>The javascript variable called &#8220;g_IsWindowShown&#8221; is declared for this purpose.<br />
As the JS Dialog doesn&#8217;t show by default, the default value of this variable become &#8220;false&#8221;. When the user click &#8220;Delete&#8221; button, we show the JS Dialog and set this variable to true. **But we return &#8220;false&#8221; in ShowWindow() function. (so that the execute wont&#8217; go to Server-side.)</p>
<p>If the user click &#8220;cancel&#8221; or &#8220;close&#8221; image, we call &#8220;hideWindow()&#8221; function. In this function, we hide the JS dialog and set the variable &#8220;g_IsWindowShown&#8221; to true. (We also return &#8220;false&#8221; in this function since we dont want the Server-side code to execute.)</p>
<p>If the user click &#8220;Delete It&#8221; button then we call &#8220;deleteit()&#8221; function. In this function, we set the text of textbox to hidden field so that this value can be read from Server-side script. then, we fire the button client event of &#8220;Delete&#8221; button (not &#8220;Delete It&#8221; button.) then, showWindow() function will be invoked again. At that time, the variable &#8220;g_IsWindowShown&#8221; will be true. After that, we just return &#8220;true&#8221; from this function. So, the Server-side code will be executed. Here is the end of our trick. :)</p>
<h4>Demo</h4>
<p>- Please open the Demo Project.<br />
- Set the breakpost at btnDelete_Click.<br />
- Please run &#8220;TestContentPage.aspx&#8221; in Demo Project.<br />
- Select some checkedboxes in the Grid.<br />
- Click &#8220;Delete&#8221; button<br />
- Type the comment<br />
- Click &#8220;Delete It&#8221; button in Javascript Dialog.<br />
Ob: The Click event of btnDelete will be invoked and you can check the value of hidden field to see what comment you hav filled. and also, you can see which checkedboxes you have selected.</p>
<h3>Conclusion</h3>
<p>Sorry if you think that my article is too long.. (plus my writing is also not very interest. :) ) Anyway, I try to explain as much clear as I can and hopefully, you will find it useful.. Please let me know if you have suggestions or comments..
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2007/01/01/custom-javascript-dialog&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2007/01/01/custom-javascript-dialog/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>ASP.NET Calendar Control and Yahoo.UI.Calendar</title>
		<link>http://michaelsync.net/2006/11/06/aspnet-calendar-control-and-yahoouicalendar</link>
		<comments>http://michaelsync.net/2006/11/06/aspnet-calendar-control-and-yahoouicalendar#comments</comments>
		<pubDate>Mon, 06 Nov 2006 12:27:49 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2006/11/06/aspnet-calendar-control-and-yahoouicalendar</guid>
		<description><![CDATA[Note: You can also see this article in codeproject. Using ASP.NET Calendar and Yahoo.UI.Calendar in ASP.NET 1.1 DEMO Project can be downloaded from the link above. Introduction The Calendar control becomes an essential control for business application developments since the...]]></description>
			<content:encoded><![CDATA[<p>Note: You can also see this article in codeproject.</p>
<p><a href="http://www.codeproject.com/KB/aspnet/aspnet-yahoouicalendar.aspx">Using ASP.NET Calendar and Yahoo.UI.Calendar in ASP.NET 1.1</a></p>
<p>DEMO Project can be downloaded from the link above.</p>
<h3>Introduction</h3>
<p>The Calendar control becomes an essential control for business application developments since the most of data entry forms used to have one or more field for Date value. Let&#8217;s say! we are working on a page called &#8220;Candidate Resume Entry&#8221; of Recruitment System. There will be some date fields such as &#8220;Date of Birth of Candidate&#8221;, &#8220;Resume Submitted Date&#8221; in that page. The calendar control needed to be used in that page. Okay. Let me stop talking about this here as I know you already know how calendar control is important for your project.</p>
<p>There are three sections in this article and each section has two parts called &#8220;<strong>Running the demo project</strong>&#8221; and &#8220;<strong>Lab</strong>&#8220;. First, you can see how it looks like by running the demo application. Then, if you wanna use this control in your project, you can read the details in &#8220;Lab&#8221;.</p>
<p>The following topics will be covered in this article.</p>
<ul>
<li>Using ASP.NET Calendar Control in ASP.NET Project</li>
<li>Showing ASP.NET Calendar Control in Popup Window</li>
<li>Using Yahoo.UI.Calendar Control in ASP.NET Project</li>
</ul>
<p>Note:</p>
<ol>
<li>I&#8217;d highly recommend you to download the demo project before start reading this article.</li>
<li>Even thought there are three different sections in my article, you can feel free to skip any section and move on to the next section that you wanna read.</li>
</ol>
<p>Thanks. Hopefully, you may find it useful.</p>
<h3>Using ASP.NET Calendar Control in ASP.NET Project</h3>
<p>This section is created only for beginners who haven&#8217;t used ASP.NET Calendar in Web Project. Feel free to skip this section if you already know about it.</p>
<h4>Running the sample</h4>
<p>1. Download and extract the zip file.<br />
2. Set SimpleCalendar.aspx as start page.<br />
3. Run the web application.<br />
<em>You will see the result as below if you click &#8220;&#8230;&#8221; button nearly Date Of Birth TextBox.</em><br />
<img src="http://michaelsync.net/wp-content/uploads/2008/01/simply_calendar.PNG" alt="Simple ASP.NET Calendar" height="288" width="412" /><br />
4. If you choose a date from Calendar Control then the selected date will be shown in TextBox and this calendar will be disappeared.</p>
<p>Do you wanna try this code in your owned project?</p>
<h4>Lab: Using ASP.NET Control in ASP.NET Project</h4>
<p>1. Create one ASP.NET Web Project (C#)<br />
2. Place TextBox and Button in WebForm</p>
<pre class="brush: xml; title: ; notranslate">
&lt;asp:TextBox ID=&quot;txtDOB&quot; Runat=&quot;server&quot;&gt;
&lt;/asp:TextBox&gt;
&lt;asp:Button ID=&quot;btnDOB&quot; Runat=&quot;server&quot; Text=&quot;...&quot;&gt;
&lt;/asp:Button&gt;
</pre>
<p>3. Add Calendar control to WebForm.<br />
( <em>Thanks to the Author of <a href="http://builder.com.com/5100-6373-5319954.html#%3Cb%3EListing%20B%3C/b%3E">this article</a> for custom style of calendar control.You can remove the style if you dont wanna customize the appearance.</em>)</p>
<pre class="brush: xml; title: ; notranslate">
&amp;lt;asp:calendar id=&quot;cdrCalendar&quot; runat=&quot;server&quot;
backcolor=&quot;#ffffff&quot; width=&quot;250px&quot; height=&quot;200px&quot;
font-size=&quot;12px&quot; font-names=&quot;Arial&quot; borderwidth=&quot;2px&quot;
bordercolor=&quot;#000000&quot; nextprevformat=&quot;shortmonth&quot;
daynameformat=&quot;firsttwoletters&quot;
&lt;strong&gt;Visible=&quot;False&quot;&lt;/strong&gt;&gt;
&lt;TodayDayStyle ForeColor=&quot;White&quot;
BackColor=&quot;Black&quot;&gt;&lt;/TodayDayStyle&gt;
&lt;NextPrevStyle Font-Size=&quot;12px&quot; Font-Bold=&quot;True&quot;
ForeColor=&quot;#333333&quot;&gt;  &lt;/NextPrevStyle&gt;
&lt;DayHeaderStyle Font-Size=&quot;12px&quot;
Font-Bold=&quot;True&quot;&gt;
&lt;/DayHeaderStyle&gt;
&lt;TitleStyle Font-Size=&quot;14px&quot; Font-Bold=&quot;True&quot;
BorderWidth=&quot;2px&quot; ForeColor=&quot;#000055&quot;&gt;
&lt;/TitleStyle&gt;
&lt;OtherMonthDayStyle ForeColor=&quot;#CCCCCC&quot;&gt;
&lt;/OtherMonthDayStyle&gt;
&lt;/asp:calendar&gt;
</pre>
<p>4. Add the following codes in Button Click Event</p>
<pre class="brush: css; title: ; notranslate">
try{
if(txtDOB.Text.Trim() != &quot;&quot;)
cdrCalendar.SelectedDate =
Convert.ToDateTime(txtDOB.Text);
}
catch
{}
//showing the calendar.
cdrCalendar.Visible= true;
</pre>
<p>5. Add the following codes in SelectionChanged Event of Calendar</p>
<pre class="brush: jscript; title: ; notranslate">
//displaying the selected date in TextBox
txtDOB.Text = cdrCalendar.SelectedDate.ToString();
//hiding the calendar.
cdrCalendar.Visible= false;
</pre>
<p>Finally, run your web application. You will see the same result as the picture above. That&#8217;s. It is Simple. isn&#8217;t it?</p>
<h3>Showing ASP.NET Calendar Control in Popup Window</h3>
<p>Now, we have some ideas about how to use ASP.NET Calendar. we will try to improve our code more better.<br />
So, How about showing the Calendar in pop-up window? Oki. Let&#8217;s see..</p>
<h4>Running the sample</h4>
<p>1. Set <strong>PopupCalendar.aspx</strong> as start page.<br />
2. Run the web application. <em>You will see the calendar in pop-up window as following picture.</em></p>
<p><img src="http://michaelsync.net/wp-content/uploads/2008/01/popup_aspnet_calendar1png.gif" alt="Popup ASP.NET Calendar" height="340" width="519" /></p>
<h4>Lab: Adding Pop-Up Calendar Control in your owned project</h4>
<p>Here are some facts if you wanna try this code in your owned project.</p>
<p>1. Three things you need to copy from demo project to your project</p>
<ul>
<li><strong>Calendar.aspx</strong> under <strong>Controls</strong> Folder</li>
<li><strong>Styles.css</strong> under CSS</li>
<li><strong>pdate.gif</strong> and <strong>today.png</strong> under <strong>Images</strong></li>
</ul>
<p>2. Two things you might need to check</p>
<p>2.1. <strong>Path of the CSS of Calendar</strong></p>
<pre class="brush: css; title: ; notranslate">
&amp;lt;link href=&lt;strong&gt;&quot;../CSS/Styles.css&quot;&lt;/strong&gt;
type=&quot;text/css&quot; rel=&quot;stylesheet&quot;&gt;
</pre>
<p>2.2. <strong>Path of the Calandar Image</strong></p>
<pre class="brush: xml; title: ; notranslate">
&amp;lt;asp:imagebutton id=&quot;BtnRefresh&quot;
runat=&quot;server&quot; ToolTip=&quot;Refresh&quot;
ImageUrl=&lt;strong&gt;&quot;../Images/today.png&quot;&lt;/strong&gt;&gt;
&lt;/asp:imagebutton&gt;
</pre>
<p>3. Three things you need to add to the page that you want this calendar to display.</p>
<p>3.1. <strong>TextBox and HyperLink</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;asp:TextBox ID=&quot;txtDOB&quot; Runat=&quot;server&quot;&gt;
&lt;/asp:TextBox&gt;&lt;asp:HyperLink id=&quot;imgDate&quot;
runat=&quot;server&quot; ImageUrl=&quot;Images/pdate.gif&quot;&gt;
HyperLink
&lt;/asp:HyperLink&gt;
</pre>
<p>3.2. <strong>Adding Javascript function to open pop-up window</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script language=&quot;javascript&quot;
type=&quot;text/javascript&quot;&gt;

function calendarPicker(strTxtRef){
window.open('./Controls/Calendar.aspx?field=' + strTxtRef   +
'','calendarPopup','titlebar=no,left=470,top=100,' +
'width=300,height=250,resizable=no');
}
&lt;/script&gt;
</pre>
<p>3.3. <strong>Calling JavaScript Function</strong></p>
<pre class="brush: jscript; title: ; notranslate">
imgDate.NavigateUrl = &quot;javascript:calendarPicker('document.Form1.&quot; +
txtDOB.ClientID.ToString() + &quot;');&quot;;
</pre>
<p>Note: <strong>Form1</strong> is the name of web form that you want calendar to display on it. If you are not sure about it, go to HTML view and check it.</p>
<p>eg:</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot;&gt;
&lt;/form&gt;
</pre>
<p>Finally, you can start running your project and check whether it&#8217;s working fine or not.<br />
Good Luck! :-)</p>
<h3>Using Yahoo.UI.Calendar Control in ASP.NET Project</h3>
<p>Personally, I don&#8217;t like that much about showing something in pop-up window. So, I was looking for something better. then I came to know <a href="http://developer.yahoo.com/yui/">Yahoo UI Library</a> which is amazing javascript library and it is compatible with the most popular browsers. Let&#8217;s take a look at the demo.</p>
<h4>Running the sample project</h4>
<p>1. Set <strong>YahooUICalendarSimplePage.aspx</strong> as start page.<br />
2. Run the web application. <em>You will see the calendar in pop-up window as following picture.</em><br />
<img src="http://michaelsync.net/wp-content/uploads/2008/01/yahoo_ui_calender_in_aspnet.PNG" alt="Using Yahoo.UI.Calendar in ASP.NET" height="308" width="458" /></p>
<h4>Lab: How to use Yahoo.UI.Calendar in your owned ASP.NET project</h4>
<p>You need to add the following stylesheets,javascript files and image in your project.</p>
<p>1. <strong>Stylesheets</strong></p>
<ol>
<li>calendar.css</li>
<li>dpSyntaxHighlighter.css</li>
<li>fonts.css</li>
<li>reset.css</li>
</ol>
<p>2. <strong>Javascript Files</strong></p>
<ol>
<li>calendar.js</li>
<li>dom.js</li>
<li>event.js</li>
<li>yahoo.js</li>
</ol>
<p>3. <strong>Image</strong></p>
<ol>
<li>pdate.gif</li>
</ol>
<p>4. <strong>In aspx file,</strong></p>
<p>Add the following code in HEAD Tag~</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;
src=&quot;./JS/yahoo.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;./JS/event.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;./JS/dom.js&quot;&gt;&lt;/script&gt;
&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot;
href=&quot;./CSS/fonts.css&quot;&gt;
&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot;
href=&quot;./CSS/reset.css&quot;&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot;
href=&quot;./CSS/dpSyntaxHighlighter.css&quot;&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;./JS/calendar.js&quot;&gt;
&lt;/script&gt;

&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot;
href=&quot;./CSS/calendar.css&quot;&gt;
&lt;script language=&quot;javascript&quot;&gt;
YAHOO.namespace(&quot;example.calendar&quot;);
function init() {
YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar(
&quot;YAHOO.example.calendar.cal1&quot;,
&lt;strong&gt;&quot;cal1Container&quot;&lt;/strong&gt;);
YAHOO.example.calendar.cal1.title = &quot;&quot;;
YAHOO.example.calendar.cal1.onSelect = setDate1;
YAHOO.example.calendar.cal1.render();
}

function showCalendar1(txtDateClientID,btnCalendarID) {
this.link1 = document.getElementById(btnCalendarID);
this.oTxtDate = document.getElementById(txtDateClientID);
var pos = YAHOO.util.Dom.getXY(link1);
YAHOO.example.calendar.cal1.oDomContainer.style.display='block';
YAHOO.util.Dom.setXY(YAHOO.example.calendar.cal1.oDomContainer,
[pos[0],pos[1]+link1.offsetHeight+1]);
}

function setDate1() {
var date1 = YAHOO.example.calendar.cal1.getSelectedDates()[0];
YAHOO.example.calendar.cal1.oDomContainer.style.display='none';
var formattedDate = date1;
&lt;strong&gt;oTxtDate.value = formattedDate.getDate()+'/'+&lt;/strong&gt;
&lt;strong&gt;(formattedDate.getMonth() +1) +'/'+
formattedDate.getFullYear()&lt;/strong&gt;;
}

YAHOO.util.Event.addListener(window, &quot;load&quot;, init);
&lt;/script&gt;
</pre>
<p>Note:</p>
<p>YAHOO.example.calendar.cal1.getSelectedDates() in setDate1() function will be returned the selected date as long date format. Even thought I have converted that long date format to short date format (DD/MM/YYYY), you can remove the last line if you wanna get long date format. &#8220;cal1Container&#8221; in init()is the id of DIV where Yahoo.UI.Calendar support to be attached.</p>
<li>Put the following code in Body Tag.
<pre class="brush: xml; title: ; notranslate">
&lt;strong&gt;
&lt;div id=&quot;cal1Container&quot;
style=&quot;DISPLAY: none; POSITION: absolute&quot; &gt;&lt;/div&gt;&lt;/strong&gt;
&amp;lt;asp:TextBox ID=&lt;strong&gt;&quot;txtDOB&quot;&lt;/strong&gt;
Runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;
&amp;lt;a id=&quot;chooseday&quot;
onclick=&quot;showCalendar1('&lt;strong&gt;&lt;% =txtDOB.ClientID %&gt;'&lt;/strong&gt;,
&lt;strong&gt;'imgCalendar'&lt;/strong&gt;)&quot; href=&quot;javascript:void(null)&quot;&gt;
&amp;lt;IMG id=&lt;strong&gt;&quot;imgCalendar&quot;&lt;/strong&gt;
border=&quot;0&quot; alt=&quot;&quot; src=&lt;strong&gt;&quot;Images/pdate.gif&quot;&lt;/strong&gt;&gt;
</pre>
<p>Note:<br />
If you are using HTML Textbox in your page, you can just pass the id of textbox to showCalendar1() function.<br />
<font color="#ff0000">In case, the calendar is showing behind the other control,<br />
you can set higher <strong>Z-ORDER</strong> of <strong>callContainer</strong> DIV which will be<br />
attached by Yahoo.UI.Calendar.(Thanks to Julia for asking such a great question.)</font></p>
<h3>Conclusion</h3>
<p>Hopefully, you may find it useful. (again) and This is the<br />
way that I used in some of my project and I&#8217;m pretty sure that it works very<br />
well in practical project.<br />
If you have any question regarding this artilce, you<br />
can feel free to leave your question as a comment in my blog. (<a href="http://michaelsync.net">http://michaelsync.net</a>) I will reply you as soon as possible.</p>
<p>Thanks.</p>
<p><strong>Related Articles ~ </strong></p>
<ul>
<li> <a href="http://michaelsync.net/2006/11/30/using-yahoouicalendar-in-pagetemplate-and-master-page-part-ii/">Using Yahoo.UI.Calendar in PageTemplate and Master Page &#8211; Part II</a></li>
<li><a href="http://michaelsync.net/2007/02/27/how-to-customizing-yahoouicalendar/">HOW TO: Customizing YAHOO.UI.CALENDAR</a></li>
</ul>
<p><strong>References</strong></p>
<ul>
<li><a href="http://builder.com.com/5100-6373-5319954.html">Using the ASP.NET Calendar control</a></li>
<li><a href="http://developer.yahoo.com/yui/">Yahoo UI</a></li>
</ul>
</li>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2006/11/06/aspnet-calendar-control-and-yahoouicalendar&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2006/11/06/aspnet-calendar-control-and-yahoouicalendar/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>JavaScript: Changing Image at runtime.</title>
		<link>http://michaelsync.net/2006/10/10/javascript-changing-image-at-runtime</link>
		<comments>http://michaelsync.net/2006/10/10/javascript-changing-image-at-runtime#comments</comments>
		<pubDate>Tue, 10 Oct 2006 09:56:12 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2006/10/10/javascript-changing-image-at-runtime</guid>
		<description><![CDATA[This is just very basic example. hum? but this is also very bad UI design that you should NOT use in your web application. Because the code doesn&#8217;t work on Web Server. In order to make this script to work,...]]></description>
			<content:encoded><![CDATA[<p>This is just very basic example. hum? but this is also very bad UI design that you should NOT use in your web application. Because the code doesn&#8217;t work on Web Server. In order to make this script to work, your have to add this page which is using this code as a trust site in Internet Explore 6 or 7. Of course, it won&#8217;t work in Mozilla-based browsers.. but the firefox extension called Noscript might help the script to work in Mozilla Firefox. (But I have tested yet.)</p>
<p><a href="http://forums.asp.net/thread/1455303.aspx">Here</a> is the discussion.</p>
<p>Feel free to let me know if you have any comment for this script.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Language&quot; content=&quot;en-us&quot;&gt;
&lt;meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 6.0&quot;&gt;
&lt;meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;&gt;
&lt;title&gt;New Page 1&lt;/title&gt;
&lt;script language=javascript&gt;
/*
Changing the image at runtime by using JavaScript.
@imgId   : ID of Image HTML Control
@strPath : The path of the image that you just browse.
*/
function changePic(imgId,strPath){
var o = document.getElementById(imgId);
var s = new String(strPath);
s = s.replace(&quot;\\&quot;,&quot;/&quot;);
alert(&quot;file:///&quot; + s);
o.src=&quot;file:///&quot; + s;
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;p&gt;
&lt;img id=“img1″ border=”0″ src=”../sm_sunita.jpg” width=”300″ height=”225″&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;input type=”file” name=”F1″ size=”20″ onchange=”changePic(‘img1′,this.value)”&gt;
&lt;/p&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><em>Note: Demo Images has been removed.</em>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2006/10/10/javascript-changing-image-at-runtime&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2006/10/10/javascript-changing-image-at-runtime/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenLaszlo</title>
		<link>http://michaelsync.net/2006/07/26/openlaszlo</link>
		<comments>http://michaelsync.net/2006/07/26/openlaszlo#comments</comments>
		<pubDate>Wed, 26 Jul 2006 18:29:00 +0000</pubDate>
		<dc:creator>Michael Sync</dc:creator>
				<category><![CDATA[Fav Links]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://michaelsync.net/2006/07/26/openlaszlo</guid>
		<description><![CDATA[OpenLaszlo OpenLaszlo is licensed under the Common Public License (Version 1.0). OpenLaszlo is an open source platform for creating zero-install web applications with the user interface capabilities of desktop client software. OpenLaszlo programs are written in XML and JavaScript and...]]></description>
			<content:encoded><![CDATA[<p><font face="Verdana" size="2"><a href="http://www.openlaszlo.org/">OpenLaszlo</a></font></p>
<p><font face="Verdana" size="2">OpenLaszlo is licensed under the Common Public License (Version 1.0).</font></p>
<p><font face="Verdana" size="2">OpenLaszlo is an open source platform for creating zero-install web applications  with the user interface capabilities of desktop client software.</font></p>
<p><font face="Verdana" size="2">OpenLaszlo programs are written in XML and JavaScript and transparently compiled  to Flash and soon DHTML. The OpenLaszlo APIs provide animation, layout, data  binding, server communication, and declarative UI. An OpenLaszlo application can  be as short as a single source file, or factored into multiple files that define  reusable classes and libraries.</font></p>
<p><font face="Verdana" size="2">OpenLaszlo is write once run everywhere. An OpenLaszlo application developed on  one machine will run on all leading Web browsers on all leading desktop  operating systems.</font></p>
<p><font face="Verdana" size="2"><a href="http://www.openlaszlo.org/"> http://www.openlaszlo.org/</a><br />
<a href="http://www.laszlosystems.com/developers/">http://www.laszlosystems.com/developers/</a></font>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://michaelsync.net/2006/07/26/openlaszlo&#038;layout=standard&#038;show_faces=false&#038;width=450&#038;height=25&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px;"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://michaelsync.net/2006/07/26/openlaszlo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

