Support Dept Support Dept http://blogs.telerik.com/SupportDept/Posts.aspx http://backend.userland.com/rss Embedding YouTube video in RadListView for ASP.NET AJAX <p>Have you ever thought of embedding a <em>YouTube</em> video in the context of a data-bound control? Recently, a client of ours asked for such a demo and this inspired me to create a code-library project that features this scenario and uses <em>RadListView for ASP.NET AJAX</em> as ‘videos host’. Depending on your goal, you can control the player via <em>JavaScript</em> code or you can just embed a static object. In the latter case you will need something like this:</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">object</span> <span style="color: #ff0000">width</span><span style="color: #0000ff">=&quot;425&quot;</span> <span style="color: #ff0000">height</span><span style="color: #0000ff">=&quot;344&quot;</span><span style="color: #0000ff">&gt;</span></pre> <!--CRLF--> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">param</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;movie&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;http://www.youtube.com/v/QT0e5XqNZdo&amp;hl=en_US&amp;fs=1&amp;rel=0&amp;color1=0x5d1719&amp;color2=0xcd311b&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">param</span><span style="color: #0000ff">&gt;</span></pre> <!--CRLF--> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">param</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;allowFullScreen&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;true&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">param</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #800000">param</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;allowscriptaccess&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;always&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">param</span><span style="color: #0000ff">&gt;</span></pre> <!--CRLF--> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4"> 4:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">embed</span> <span style="color: #ff0000">src</span><span style="color: #0000ff">=&quot;http://www.youtube.com/v/QT0e5XqNZdo&amp;hl=en_US&amp;fs=1&amp;rel=0&amp;color1=0x5d1719&amp;color2=0xcd311b&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;application/x-shockwave-flash&quot;</span> <span style="color: #ff0000">allowscriptaccess</span><span style="color: #0000ff">=&quot;always&quot;</span> <span style="color: #ff0000">allowfullscreen</span><span style="color: #0000ff">=&quot;true&quot;</span> <span style="color: #ff0000">width</span><span style="color: #0000ff">=&quot;425&quot;</span> <span style="color: #ff0000">height</span><span style="color: #0000ff">=&quot;344&quot;</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #800000">embed</span><span style="color: #0000ff">&gt;</span></pre> <!--CRLF--> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5"> 5:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">object</span><span style="color: #0000ff">&gt;</span></pre> <!--CRLF--></div> </div> <p>In some cases you may need to use the “<em>chromeless</em>” player in order to customize the default appearance and to gain control over some of the <em>YouTube</em> player's functions via <em>JS</em> – this is a bit more tricky because you should cue the video in the <em>onYouTubePlayerReady</em> handler for each separate player. As we know, it is not feasible to evaluate the <em>url</em> directly (via server-side expressions) because you will end up with all players playing the same (last) video. This is why I decided to serialize a basic array to store the item indices along with the corresponding <em>urls</em>. This approach is fast and easy enough so everyone can take advantage of it.</p> <p>&#160;</p> <p></p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-EmbeddingYouTubevideoinRadListView_148EC-screenshot_2.sflb"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="screenshot" border="0" alt="screenshot" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-EmbeddingYouTubevideoinRadListView_148EC-screenshot_thumb.sflb" width="244" height="209" /></a> </p> <p>&#160;</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:3ad52d0e-b1fe-4fc7-abf2-e5a7ad52d49e" class="wlWriterEditableSmartContent"><p> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-EmbeddingYouTubevideoinRadListView_148EC-_u_Simple_Demo_RadListView_YouTube.sflb" target="_blank">Download this demo</a></p></div> <p>&#160;</p> <p>Daniel</p> http://blogs.telerik.com/SupportDept/Posts/10-01-28/embedding_youtube_video_in_radlistview_for_asp_net_ajax.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/10-01-28/embedding_youtube_video_in_radlistview_for_asp_net_ajax.aspx 82986bc8-2796-442d-8af6-03546e47b4ad Thu, 28 Jan 2010 15:26:37 GMT Choose your preferred data layout with RadListView for ASP.NET AJAX <p>Did you hear the bells and whistles which accompanied the public <a href="http://www.telerik.com/community/labs/radcontrols-for-asp-net-ajax-q3-2009-beta.aspx">Q3 2009 Beta release</a> of RadControls for ASP.NET AJAX? If not, I think it is time to explore it and get acquainted with the new controls/features that we will be introducing for the official Q3 2009 release expected in the first week of November.</p> <p>One of the new controls that I encourage you to play with is <a href="http://demos.telerik.com/aspnet-ajax-beta/listview/examples/overview/defaultcs.aspx">RadListView for ASP.NET AJAX</a>. If you allow me to quote one of our clients who already gave the Q3 2009 Beta a spin, it is "something like a rotator on steroids" which allows you to choose from a set of commonly used predefined layouts as well as to define your custom type of layout to visualize data. Inspired by the <a href="http://weblogs.asp.net/scottgu/archive/2007/08/10/the-asp-listview-control-part-1-building-a-product-listing-page-with-clean-css-ui.aspx">MS ListView control</a>, it combines the template mechanism and presentation/editing/selection/grouping features of the Microsoft control along with integrated sorting, paging, etc. capabilities. Adding images to RadListView's items? Not a problem - simply embed them in the item templates and specify local path or a field in the database from where they will be streamed in binary format and you should be done. <br /> <br /> If I already tempted you to see some examples and learn more about this new product, go straight to the <a href="http://demos.telerik.com/aspnet-ajax-beta/listview/examples/overview/defaultcs.aspx">Q3 Beta online demos</a> - below are a couple of screenshots that shows the beauty:&nbsp; <br /> <br /> <a href="http://demos.telerik.com/aspnet-ajax-beta/listview/examples/appearancestyling/customlayouts/defaultcs.aspx"><img height="244" width="233" style="border-style: solid; border-width: 0px;" alt="RadListView_customlayouts" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-RadListView_customlayouts_1.sflb" /></a> <a href="http://demos.telerik.com/aspnet-ajax-beta/listview/examples/databinding/net2datasourcecontrols/defaultcs.aspx"><img height="144" width="244" style="border-style: solid; border-width: 0px;" alt="RadListView_datasourcecontrols" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-RadListView_datasourcecontrols_1.sflb" /></a> <a href="http://demos.telerik.com/aspnet-ajax-beta/listview/examples/sorting/defaultcs.aspx"><img height="147" width="244" style="border-style: solid; border-width: 0px;" alt="RadListView_sorting" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-RadListView_sorting_1.sflb" /></a> <br /> <br /> <br /> What, did I say grouping? Well, if you currently cannot find a demo on this subject, fear not - the feature is in the works and will be announced for the official release of the product.&nbsp; For a sneak peak see the screenshot below:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-RadListView_grouping.sflb"><img height="241" width="244" style="border-style: solid; border-width: 0px;" alt="RadListView_grouping" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-RadListView_grouping_thumb.sflb" /></a> </p> <p>But wait, there is more! Another new control - <a href="http://demos.telerik.com/aspnet-ajax-beta/listview/examples/paging/raddatapager/defaultcs.aspx">RadDataPager</a> - is the little fellow which can be easily plugged to RadListView and perform the navigation between listview's items for you. Incorporating different pager fields for data navigation(next/prev/first/last sets of buttons, numbers, page size combo, numeric field with Go button, slider pager, etc.) as well as predefined pager modes easily configurable from design-time make the usage of this control a breeze. <br /> <br /> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-RadDataPager_designtime_2.sflb"><img height="52" width="244" style="border-style: solid; border-width: 0px;" alt="RadDataPager_designtime" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-RadDataPager_designtime_thumb.sflb" /></a> <a href="http://demos.telerik.com/aspnet-ajax-beta/listview/examples/paging/raddatapager/defaultcs.aspx"><img height="92" width="244" style="border-style: solid; border-width: 0px;" alt="RadListView_RadDataPager" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-RadListView_RadDataPager_1.sflb" /></a> <br /> <br /> And let me share a secret - its future interoperability with RadGrid for ASP.NET AJAX (as an external pager) is not far away.. <br /> <br /> Already got your attention? Get your hands on the Q3 2009 Beta release of RadControls for ASP.NET AJAX now and do not hesitate to share your feedback with us - we are listening as always.</p> <p>&nbsp;</p> <p>Stefan</p> http://blogs.telerik.com/SupportDept/Posts/09-10-27/choose_your_preferred_data_layout_with_radlistview_for_asp_net_ajax.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-10-27/choose_your_preferred_data_layout_with_radlistview_for_asp_net_ajax.aspx 95832d97-edb6-4943-be7a-b52e65e990d2 Tue, 27 Oct 2009 11:26:00 GMT Using jQuery to customize RadScheduler <p><span style="line-height: 115%; font-family: 'calibri','sans-serif'; font-size: 12pt;">Telerik RadControls' for ASP.NET AJAX rendering is quite jQuery friendly. This is because almost all important html elements are tagged by a css class and therefore can be easily accessed using jQuery. <span style="font-size: 12pt;"><span style="font-family: calibri;">In this blog post I have collected various cases from our forums and ticketing system on using jQuery to customize RadScheduler.  Special thanks to all customers or visitors who raised those questions. </span></span></span></p> <span style="line-height: 115%; font-family: 'calibri','sans-serif'; font-size: 12pt;"><span style="font-size: 12pt;"> <p style="line-height: normal; margin: 0in 0in 10pt;"><span style="font-size: 12pt;"><span style="font-family: calibri;"><strong>Q</strong>:  “I have a scheduler in timeline view showing six weeks of information.  Is it possible to change the header row background for the first two weeks?”</span></span></p> </span></span> <p><span style="line-height: 115%; font-family: 'calibri','sans-serif'; font-size: 12pt;"><span style="font-size: 12pt;"><img width="300" height="57" alt="highlight first two weeks in timeline view" src="http://blogs.telerik.com/Libraries/Marketing_team/HighlightFirstTwoWeeks_1.sflb" /></span></span></p> <p><span style="line-height: 115%; font-family: 'calibri','sans-serif'; font-size: 12pt;"><span style="font-size: 12pt;"><strong>A</strong>: <span style="font-size: 12pt;"><span style="font-family: calibri;">The first step in finding a solution is to examine the rendered html using Firebug, IE Developer Tools, or any other similar tool. You will notice that the date headers are rendered in &lt;th&gt; tags of a table with a css class <i>rsHorizontalHeaderTable</i>:</span></span> </span></span></p> <span style="line-height: 115%; font-family: 'calibri','sans-serif'; font-size: 12pt;"><span style="font-size: 12pt;"> <div style="border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid; line-height: 100% !important; background-color: white; font-family: courier new; font-size: 11px; overflow: auto; border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid;"> <table style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="border-bottom: #f7f7f7 1px solid; padding-left: 10px; font-family: courier new; white-space: nowrap; font-size: 11px;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">table </span><span style="color: #ff0000;">style</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"width: 100%; height: 25px"</span><span style="font-size: 11px;"> </span><span style="color: #ff0000;">class</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"rsHorizontalHeaderTable"</span><span style="font-size: 11px;"> </span><span style="color: #ff0000;">border</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"0"</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">        <span style="color: #ff0000;">cellspacing</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"0"</span><span style="font-size: 11px;"> </span><span style="color: #ff0000;">cellpadding</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"0"</span><span style="font-size: 11px;">&gt;  </span></td> </tr> <tr> <td>        <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">tbody</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">            <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">tr</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                    <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">7/14/2009</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                    <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">7/21/2009</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                    <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">7/28/2009</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                    <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">8/4/2009</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                    <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">8/11/2009</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>                    <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">8/18/2009</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">span</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">th</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>            <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">tr</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">        <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">tbody</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>    <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">table</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> </tbody> </table> </div> <p>Therefore, we access the collection of &lt;th&gt; elements of a table with the specified class name with: $("table.rsHorizontalHeaderTable th"). Then we use the <strong>slice</strong>(0, i) method to take the first i elements starting with the first. Here is the complete code:</p> <div style="border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid; line-height: 100% !important; background-color: white; font-family: courier new; font-size: 11px; overflow: auto; border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid;"> <table style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="border-bottom: #f7f7f7 1px solid; padding-left: 10px; font-family: courier new; white-space: nowrap; font-size: 11px;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;">&lt;script type=</span><span style="color: #0000ff;">"text/javascript"</span><span style="font-size: 11px;">&gt;       </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">       <span style="color: #0000ff;">window</span><span style="font-size: 11px;">.$ = $telerik.$;       </span></td> </tr> <tr> <td>       <span style="color: #0000ff;">function</span><span style="font-size: 11px;"> pageLoad()        </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">       {       </td> </tr> <tr> <td>          <span style="color: #0000ff;">var</span><span style="font-size: 11px;"> scheduler = $find(</span><span style="color: #0000ff;">'&lt;%=RadScheduler1.ClientID %&gt;'</span><span style="font-size: 11px;">);       </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">          <span style="color: #0000ff;">if</span><span style="font-size: 11px;"> (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.TimelineView)        </span></td> </tr> <tr> <td>          {       </td> </tr> <tr> <td style="background-color: #f7f7f7;">              <span style="color: #008000;">//2 weeks out of 6 weeks view is one third of header cells, hence:      </span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>              <span style="color: #0000ff;">var</span><span style="font-size: 11px;"> i = </span><span style="color: #0000ff;">this</span><span style="font-size: 11px;">.$(</span><span style="color: #0000ff;">"table.rsHorizontalHeaderTable th"</span><span style="font-size: 11px;">).length / 3;       </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">              $(<span style="color: #0000ff;">"table.rsHorizontalHeaderTable th"</span><span style="font-size: 11px;">).slice(0, i).css(</span><span style="color: #0000ff;">"background"</span><span style="font-size: 11px;">, </span><span style="color: #0000ff;">"orange"</span><span style="font-size: 11px;">);                     </span></td> </tr> <tr> <td>          }       </td> </tr> <tr> <td style="background-color: #f7f7f7;">       }       </td> </tr> <tr> <td>   &lt;/script&gt;   </td> </tr> </tbody> </table> </div> <p> </p> <p style="margin: 0in 0in 10pt;"><span style="font-family: calibri;"><strong>Q</strong>: “By default, clicking on a date number in Month view switches to Day view of the clicked date. How can I disable this functionality?”</span></p> <p style="margin: 0in 0in 10pt;"><span style="font-family: calibri;"><strong>A</strong>: We find all elements that have the rsDateHeader css class and disable their click and doubleclick events.</span> </p> <div style="border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid; line-height: 100% !important; background-color: white; font-family: courier new; font-size: 11px; overflow: auto; border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid;"> <table style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="border-bottom: #f7f7f7 1px solid; padding-left: 10px; font-family: courier new; white-space: nowrap; font-size: 11px;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;">&lt;telerik:RadScriptBlock ID=</span><span style="color: #0000ff;">"RadScriptBlock1"</span><span style="font-size: 11px;"> runat=</span><span style="color: #0000ff;">"server"</span><span style="font-size: 11px;">&gt;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">        &lt;script type=<span style="color: #0000ff;">"text/javascript"</span><span style="font-size: 11px;">&gt;  </span></td> </tr> <tr> <td>            <span style="color: #0000ff;">window</span><span style="font-size: 11px;">.$ = $telerik.$;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7;"> </td> </tr> <tr> <td>            <span style="color: #0000ff;">function</span><span style="font-size: 11px;"> pageLoad() {  </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                <span style="color: #0000ff;">var</span><span style="font-size: 11px;"> scheduler = $find(</span><span style="color: #0000ff;">"&lt;%= RadScheduler1.ClientID %&gt;"</span><span style="font-size: 11px;">);  </span></td> </tr> <tr> <td>                <span style="color: #0000ff;">if</span><span style="font-size: 11px;"> (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.MonthView) {  </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                    $(<span style="color: #0000ff;">".rsDateHeader"</span><span style="font-size: 11px;">).each(</span><span style="color: #0000ff;">function</span><span style="font-size: 11px;">() {  </span></td> </tr> <tr> <td>                        $(<span style="color: #0000ff;">this</span><span style="font-size: 11px;">).click(doNothing).dblclick(doNothing);  </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                    });  </td> </tr> <tr> <td>                }  </td> </tr> <tr> <td style="background-color: #f7f7f7;">            }  </td> </tr> <tr> <td> </td> </tr> <tr> <td style="background-color: #f7f7f7;">            <span style="color: #0000ff;">function</span><span style="font-size: 11px;"> doNothing(e) {  </span></td> </tr> <tr> <td>                <span style="color: #0000ff;">if</span><span style="font-size: 11px;"> (!e) e = </span><span style="color: #0000ff;">window</span><span style="font-size: 11px;">.event;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7;"> </td> </tr> <tr> <td>                e.cancelBubble = <span style="color: #0000ff;">true</span><span style="font-size: 11px;">;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">                <span style="color: #0000ff;">if</span><span style="font-size: 11px;"> (e.stopPropagation) {  </span></td> </tr> <tr> <td>                    e.stopPropagation();  </td> </tr> <tr> <td style="background-color: #f7f7f7;">                }  </td> </tr> <tr> <td>            }  </td> </tr> <tr> <td style="background-color: #f7f7f7;">        &lt;/script&gt;  </td> </tr> <tr> <td>    &lt;/telerik:RadScriptBlock&gt; </td> </tr> </tbody> </table> </div> <p> </p> <p><strong>Q</strong>: "How can i scroll to the first appointment in a dayview. The dayview allways beginns at the first position. I want to scroll to automatically to the first appointment."</p> <p><strong>A</strong>: The following code finds the first appointment and calls the scrollIntoView() method:</p> <div style="border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid; line-height: 100% !important; background-color: white; font-family: courier new; font-size: 11px; overflow: auto; border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid;"> <table style="border-bottom: #eee 0px solid; border-right-width: 0px; background-color: #fff; margin: 2px 0px; width: 99%; border-collapse: collapse; border-top-width: 0px; border-left-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="border-bottom: #f7f7f7 1px solid; padding-left: 10px; font-family: courier new; white-space: nowrap; font-size: 11px;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;">&lt;script type=</span><span style="color: blue;">"text/javascript"</span><span style="font-size: 11px;">&gt;    </span></td> </tr> <tr> <td style="background-color: #f7f7f7;"><span style="color: blue;">function</span><span style="font-size: 11px;"> pageLoad(){    </span></td> </tr> <tr> <td>    $ = $telerik.$;    </td> </tr> <tr> <td style="background-color: #f7f7f7;">    <span style="color: blue;">var</span><span style="font-size: 11px;"> scheduler = $find(</span><span style="color: blue;">"&lt;%= RadScheduler1.ClientID %&gt;"</span><span style="font-size: 11px;">);    </span></td> </tr> <tr> <td>    <span style="color: blue;">var</span><span style="font-size: 11px;"> firstApp = $(</span><span style="color: blue;">".rsApt"</span><span style="font-size: 11px;">)[0];    </span></td> </tr> <tr> <td style="background-color: #f7f7f7;">    <span style="color: blue;">if</span><span style="font-size: 11px;"> (firstApp)     </span></td> </tr> <tr> <td>        firstApp.scrollIntoView();    </td> </tr> <tr> <td style="background-color: #f7f7f7;">}    </td> </tr> <tr> <td>&lt;/script&gt;    </td> </tr> <tr> <td style="background-color: #f7f7f7;"> </td> </tr> </tbody> </table> </div> </span></span>  http://blogs.telerik.com/SupportDept/Posts/09-07-14/using_jquery_to_customize_radscheduler-609588899.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-07-14/using_jquery_to_customize_radscheduler-609588899.aspx ea93d81e-56c6-4e44-ac26-9873308573f9 Tue, 14 Jul 2009 09:24:03 GMT Common RadWindow issues and their solution <p>The <a target="_blank" href="http://demos.telerik.com/aspnet-ajax/window/examples/overview/defaultcs.aspx">RadWindow</a> control is part of the Telerik’s <a target="_blank" href="http://www.telerik.com/products/aspnet-ajax.aspx">RadControls for ASP.NET AJAX</a> suite and is intended to replace the standard browser’s popup (window.open()). Since the control is based on an IFRAME, it behaves just like one – basically, whatever can be done with an IFRAME, can be achieved with RadWindow as well. This fact is useful when you investigate a reason for some problem related to the RadWindow control. Just replace the RadWindow with a standard IFRAME or browser’s popup and see how your application will behave in this case. If the problem still exists, then it is not related to the RadWindow control but is most probably a default browser’s behavior or a problem in the used logic itself. </p> <p>Below you can see several common cases that occur when RadWindow is used and what is the best approach in such scenarios. </p> <ol> <li> <p><strong>Video / audio keep playing after window is closed</strong></p> This happens because by default, when a RadWindow is closed, its object is not destroyed but remains hidden on the page so it can be quickly called again when needed. There are 2 ways to avoid that issue: <ol> <li>Set <strong>DestroyOnClose=true</strong>. See p.5 for more details on the subject. </li> <li>Use the <strong>OnClientClose</strong> event handler that is called every time when a RadWindow is closed. There you could use setUrl() client-side method to change the content page’s Url which will stop the media as well. <br /> e.g. <br /> <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">script</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="text/javascript"&gt;</span><span style="color: #000000;"></span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">function</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">ShowWindow()</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">{</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">var</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">oWnd</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">=</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">window</span><span style="color: #000000;">.radopen(</span><span style="color: #808080;">'Dialog1.aspx'</span><span style="color: #000000;">,</span><span style="color: #808080;"> 'window1'</span><span style="color: #000000;">)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp;</span><span style="color: #006400;">//Opens the window&nbsp; <br /> </span><span style="color: #808080;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">oWnd.add_close(OnClientClose)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp;</span><span style="color: #006400;">//set a function to be called when RadWindow is closed&nbsp; <br /> </span><span style="color: #808080;">&nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">}</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">function</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">OnClientClose(oWnd)</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">{</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">oWnd.setUrl(</span><span style="color: #808080;">"about:blank"</span><span style="color: #000000;">)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp;</span><span style="color: #006400;">// Sets url to blank <br /> </span><span style="color: #808080;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">oWnd.remove_close(OnClientClose)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp;</span><span style="color: #006400;">//remove the close handler - it will be set again on the next opening <br /> </span><span style="color: #808080;">&nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">}</span><span style="color: #808080;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"> <br /> <br /> </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">telerik:RadWindowManager</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="RadWindowManager1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;"> <br /> </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">telerik:RadWindowManager</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"> <br /> </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">button</span><span style="color: #ff0000;"> onclick</span><span style="color: #0000ff;">="ShowWindow(); return false;"&gt;</span><span style="color: #000000;"> <br /> &nbsp;&nbsp;&nbsp; open RadWindow</span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">button</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"></span> <br /> </li> </ol> </li> <li> <p><strong>RadMenu overlaps RadWindow</strong></p> This behavior is expected – by design RadMenu has a higher z-Index value than the RadWindow control. This is needed in common cases where a <a target="_blank" href="http://demos.telerik.com/aspnet-ajax/window/examples/restrictionzone/defaultcs.aspx">RestrictionZone</a> is used and the RadMenu control is above that zone. To render the RadWindow control above RadMenu, all you need to do is to change its z-Index, according to <a target="_blank" href="http://www.telerik.com/help/aspnet-ajax/controlling-absolute-positioning-with-zindex.html">this help</a> article. There is a <a target="_blank" href="http://www.telerik.com/support/kb/aspnet-ajax/window/show-radwindow-above-radmenu.aspx">KB article</a> on the same subject as well. </li> <li><strong>Using OffsetElementID and Top / Left properties together</strong> <br /> When OffsetElementID is specified, Top and Left are calculated towards that element's top left corner. If OffsetElementID is not specified, Top and Left are calculated towards the page's top left corner.&nbsp; Top and Left can be used along with the RestrictionZoneID property as well - if the RestrictionZoneID property is set,&nbsp; Top and Left will be calculated towards the top left corner of the restriction zone. </li> <li><strong>OpenerElementID is not working as expected in some scenarios</strong> <br /> By using the OpenerElementID property it is possible to specify the id of an HTML element that, when clicked, will automatically open the corresponding RadWindow object. The opener can be any element on the page that has an ID attribute - the property expect a client ID, so if you are setting it to a server element, you need to use its ClientID (<span style="color: #000000;">OpenerElementID</span><span style="color: #0000ff;">=</span><span style="color: #808080;">"&lt;%# ServerButton.ClientID %&gt;"</span> ). <br /> <br /> Note that if you set this property to a postback element like asp:Button control, the server-side click event of that element will not fire. That is why we recommend using OpenerElementID in simple scenarios only. OpenerElementID is not suitable for ajaxified and databinding scenarios as well. For example if you have a standard asp:Repeater control or RadGrid where you need to open RadWindows by clicking some elements in the columns, you will have to declare number of RadWindows equal to the number of the opener elements in the grid. In such scenarios it is recommended to use RadWindow's client-side or server-side API. </li> <li><strong>Once a RadWindow is closed, it “loses” all its settings (width, height, modality, etc.) <br /> </strong>This could happen if you have set DestroyOnClose to true. When this property is set to true, RadWindow’s object will be destroyed once the window is closed. This, however,&nbsp; means that you will not be able to open that same RadWindow again until the whole page is reloaded. In such scenario, it will be best to either set all needed properties (width, height, modality, etc.) to the RadWindowManager or as an alternative – to use the <a target="_blank" href="http://www.telerik.com/help/aspnet-ajax/window_programmingradwindowmethods.html">client-side API</a> and set them when opening the RadWindow. </li> </ol> <p>More information about the RadWindow control is available in the control’s <a target="_blank" href="http://www.telerik.com/help/aspnet-ajax/windowoverview.html">documentation</a> – check the Programming section for more tips and tricks. </p> <p>&nbsp;</p> <p>Georgi Tunev</p> <p>Telerik</p> http://blogs.telerik.com/SupportDept/Posts/09-06-04/common_radwindow_issues_and_their_solution.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-06-04/common_radwindow_issues_and_their_solution.aspx e622a2aa-e5de-462d-b195-847b030481bb Thu, 04 Jun 2009 07:21:54 GMT Executing JavaScript function from server-side code <p>This is a pretty common scenario when working with WebForms. There are many ways to achieve the desired result, but they have one thing in common – you should make sure that the controls are fully loaded in the page before trying to get a reference to them and use them in your JavaScript code. </p> <p>In <strong>ASP.NET</strong> it is pretty straightforward to do that. For example you could use a label: <br /> <strong>ASPX <br /> </strong><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">head</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">title</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;">Untitled Page</span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">title</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">script</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="text/javascript"&gt;</span><span style="color: #000000;"></span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">function</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">calledFn()</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">{</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">alert</span><span style="color: #000000;">(</span><span style="color: #808080;">"code fired"</span><span style="color: #000000;">)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">}</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"> <br /> </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">head</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"> <br /> </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">form</span><span style="color: #ff0000;"> id</span><span style="color: #0000ff;">="form1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;"> <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">asp:Button</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="Button1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="Run JavaScript Code"</span><span style="color: #ff0000;"> OnClick</span><span style="color: #0000ff;">="Button1_Click"</span><span style="color: #ff0000;">&nbsp;</span><span style="color: #0000ff;">/&gt; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</span><span style="color: #800000;">asp:Label</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="Label1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;"></span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">asp:Label</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">form</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"></span> </p> <p>&nbsp;</p> <p><strong>C#</strong> <br /> <span style="color: #0000ff;">protected</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">Button1_Click(</span><span style="color: #0000ff;">object</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">sender,</span><span style="color: #808080;">&nbsp;</span><span style="color: #2b91af;">EventArgs</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">e)</span><span style="color: #808080;"> <br /> </span><span style="color: #000000;">{</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">Label1.Text</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">=</span><span style="color: #808080;"> "&lt;script type='text/javascript'&gt;calledFn()&lt;/script&gt;"</span><span style="color: #0000ff;">;</span><span style="color: #808080;"> <br /> </span><span style="color: #000000;">}</span> </p> <p><strong>VB.NET <br /> </strong><span style="color: #0000ff;">Protected</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Sub</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">Button1_Click(sender</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">As</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Object</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">e</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">As</span><span style="color: #808080;">&nbsp;</span><span style="color: #2b91af;">EventArgs</span><span style="color: #000000;">)</span><span style="color: #808080;"> <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">Label1.Text</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">=</span><span style="color: #808080;"> "&lt;script type='text/javascript'&gt;calledFn()&lt;/script&gt;" <br /> </span><span style="color: #0000ff;">End</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Sub</span> </p> <p>As an alternative, you could use Literal, <a shape="rect" target="_blank" href="http://msdn.microsoft.com/en-us/library/system.web.ui.page.registerstartupscript.aspx">Page.RegisterStartupScript</a>, <a shape="rect" target="_blank" href="http://msdn.microsoft.com/en-us/library/system.web.ui.page.registerclientscriptblock.aspx">Page.RegisterClientScriptBlock</a> or if you are using ASP.NET 2.x - <a shape="rect" target="_blank" href="http://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerstartupscript.aspx">ClientScriptManager.RegisterStartupScript</a> /&nbsp; <a shape="rect" target="_blank" href="http://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerclientscriptblock.aspx">ClientScriptManager.RegisterClientScriptBlock</a> methods.</p> <p>Note: <em>The main difference between RegisterClientScriptBlock and RegisterStartupScript methods is that RegisterClientScriptBlock places the JavaScript directly after the opening &lt;form&gt; element in the page while RegisterStartupScript inserts the code at the end of the page, right before the closing &lt;/form&gt; tag. </em></p> <p>&nbsp;</p> <p>In <strong>ASP.NET AJAX</strong> environment however, you should take into consideration the fact that the ASP.NET AJAX controls are loaded after <em>window.onload</em> is fired. You can verify this by putting some ASP.NET AJAX controls (I would personally recommend using <a shape="rect" target="_blank" href="http://www.telerik.com/products/aspnet-ajax.aspx">RadControls for ASP.NET AJAX</a> ;) ) and then examine the HTML of the rendered page. </p> <p>Again, there are several ways to ensure that the controls are loaded on the client before trying to use them. If you want to use the RegisterStartupScript() method, I would recommend to check the ASP.NET <a shape="rect" target="_blank" href="http://www.asp.net/AJAX/Documentation/Live/ClientReference/Sys/ApplicationClass/SysApplicationLoadEvent.aspx">AJAX’s Sys.Application.Load</a> event. This event is raised after all scripts have been loaded on the page and the controls have been created and initialized. You need to make sure however, that the code that you will insert in the Load event will be executed only once and then removed, otherwise it will be called after every Ajax callback. For example you could use the following logic: <br /> <span style="color: #0000ff;">function</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">f()</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #000000;">{</span><span style="color: #808080;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #006400;">//code <br /> </span><span style="color: #808080;">&nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">Sys.Application.remove_load(f)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #000000;">}</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #000000;">Sys.Application.add_load(f)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp;</span> </p> <p>&nbsp;</p> <p>For example let’s call the RadWindow’s radalert() function after a postback by using the code above</p> <p><strong>ASPX:</strong> <br /> <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">form</span><span style="color: #ff0000;"> id</span><span style="color: #0000ff;">="form1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">asp:ScriptManager</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="ScriptManager1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"</span><span style="color: #ff0000;">&nbsp;</span><span style="color: #0000ff;">/&gt; <br /> &nbsp;&nbsp;&nbsp; &lt;</span><span style="color: #800000;">telerik:RadWindowManager</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="RadWindowManager1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">telerik:RadWindowManager</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">asp:Button</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="Button1"</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="Postback and show RadAlert"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"</span><span style="color: #ff0000;">&nbsp; OnClick</span><span style="color: #0000ff;">="Button1_Click"</span><span style="color: #ff0000;">&nbsp;</span><span style="color: #0000ff;">/&gt; <br /> &lt;/</span><span style="color: #800000;">form</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"></span> </p> <p><strong>C# <br /> </strong><span style="color: #0000ff;">protected</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">Button1_Click(</span><span style="color: #0000ff;">object</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">sender,</span><span style="color: #808080;">&nbsp;</span><span style="color: #2b91af;">EventArgs</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">e)</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #000000;">{</span><span style="color: #808080;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">string</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">radalertscript</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">=</span><span style="color: #808080;"> "&lt;script language='javascript'&gt;function f(){radalert('Welcome to RadWindow for &lt;strong&gt;ASP.NET AJAX&lt;/strong&gt;!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);&lt;/script&gt;"</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Page</span><span style="color: #000000;">.ClientScript.RegisterStartupScript(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.GetType(),</span><span style="color: #808080;"> "radalert"</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">radalertscript)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #000000;">}</span><span style="color: #808080;">&nbsp;</span> </p> <p>&nbsp;</p> <p><strong>VB.NET <br /> </strong><span style="color: #0000ff;">Protected</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Sub</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">Button1_Click(sender</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">As</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Object</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">e</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">As</span><span style="color: #808080;">&nbsp;</span><span style="color: #2b91af;">EventArgs</span><span style="color: #000000;">)</span><span style="color: #808080;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">Dim</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">radalertscript</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">As</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">String</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">=</span><span style="color: #808080;"> "&lt;script language='javascript'&gt;function f(){radalert('Welcome to RadWindow &lt;strong&gt;ASP.NET AJAX&lt;/strong&gt;!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);&lt;/script&gt;" <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Page</span><span style="color: #000000;">.ClientScript.RegisterStartupScript(</span><span style="color: #0000ff;">Me</span><span style="color: #000000;">.[</span><span style="color: #0000ff;">GetType</span><span style="color: #000000;">](),</span><span style="color: #808080;"> "radalert"</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">radalertscript)</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #0000ff;">End</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Sub</span><span style="color: #808080;">&nbsp;</span> </p> <p>&nbsp; </p> <p>If you are working with Ajax callbacks however, I would suggest to use asp:Scriptmanager’s <a shape="rect" target="_blank" href="http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerstartupscript.aspx">RegisterStartupScript()</a> method.</p> <p>&nbsp;</p> <p></p> <p><strong>ASPX <br /> </strong><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">form</span><span style="color: #ff0000;"> id</span><span style="color: #0000ff;">="form1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">asp:ScriptManager</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="ScriptManager1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">asp:ScriptManager</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">telerik:RadWindowManager</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="RadWindowManager1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">telerik:RadWindowManager</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">asp:UpdatePanel</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="UpdatePanel1"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">ContentTemplate</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">asp:Button</span><span style="color: #ff0000;"> ID</span><span style="color: #0000ff;">="Button1"</span><span style="color: #ff0000;"> Text</span><span style="color: #0000ff;">="CallBack and show RadAlert"</span><span style="color: #ff0000;"> runat</span><span style="color: #0000ff;">="server"</span><span style="color: #ff0000;"> OnClick</span><span style="color: #0000ff;">="Button1_Click"</span><span style="color: #ff0000;">&nbsp;</span><span style="color: #0000ff;">/&gt; <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</span><span style="color: #800000;">ContentTemplate</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">asp:UpdatePanel</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;">&nbsp; <br /> </span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">form</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"></span> </p> <p><strong>C# <br /> </strong><span style="color: #0000ff;">protected</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">Button1_Click(</span><span style="color: #0000ff;">object</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">sender,</span><span style="color: #808080;">&nbsp;</span><span style="color: #2b91af;">EventArgs</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">e)</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #000000;">{</span><span style="color: #808080;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">string</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">scriptstring</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">=</span><span style="color: #808080;"> "radalert('Welcome to Rad&lt;strong&gt;Window&lt;/strong&gt;!', 330, 210);"</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">ScriptManager.RegisterStartupScript(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">this</span><span style="color: #000000;">.GetType(),</span><span style="color: #808080;"> "radalert"</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">scriptstring,</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">true</span><span style="color: #000000;">)</span><span style="color: #0000ff;">;</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #000000;">}</span> </p> <p><strong>VB.NET <br /> </strong><span style="color: #0000ff;">Protected</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Sub</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">Button1_Click(</span><span style="color: #0000ff;">ByVal</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">sender</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">As</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Object</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">ByVal</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">e</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">As</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">System.</span><span style="color: #2b91af;">EventArgs</span><span style="color: #000000;">)</span><span style="color: #808080;">&nbsp; <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #0000ff;">Dim</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">scriptstring</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">As</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">String</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">=</span><span style="color: #808080;"> "radalert('Welcome to Rad&lt;strong&gt;Window&lt;/strong&gt;!', 330, 210);" <br /> &nbsp;&nbsp;&nbsp; </span><span style="color: #000000;">ScriptManager.RegisterStartupScript(</span><span style="color: #0000ff;">Me</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Me</span><span style="color: #000000;">.[</span><span style="color: #0000ff;">GetType</span><span style="color: #000000;">](),</span><span style="color: #808080;"> "radalert"</span><span style="color: #000000;">,</span><span style="color: #808080;">&nbsp;</span><span style="color: #000000;">scriptstring,</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">True</span><span style="color: #000000;">)</span><span style="color: #808080;">&nbsp; <br /> </span><span style="color: #0000ff;">End</span><span style="color: #808080;">&nbsp;</span><span style="color: #0000ff;">Sub</span><span style="color: #808080;">&nbsp;</span> </p> <p>More information on this subject can also be found in these KB articles (they are about RadWindow but use general approaches that can be applied to different scenarios:</p> <ul> <li><a shape="rect" target="_blank" href="http://www.telerik.com/support/kb/aspnet-ajax/window/calling-radalert-from-codebehind.aspx">Calling radalert from codebehind (all versions of RadWindow)</a> </li> <li><a shape="rect" target="_blank" href="http://www.telerik.com/support/kb/aspnet-ajax/window/radwindow-that-postbacks-and-manipulates-opener-page-on-its-reload.aspx">RadWindow that postbacks and manipulates opener page on its reload</a> </li> </ul> <p>And in the following MSDN article: <a shape="rect" target="_blank" href="http://msdn.microsoft.com/en-us/library/aa479390.aspx">Using JavaScript Along with ASP.NET 2.0</a> (by Bill Evjen) </p> <p>&nbsp;</p> <p>In conclusion: Calling JavaScript function from server is a relatively easy task. Just make sure that:</p> <ol> <li>The code is actually inserted on the page – the easiest way is to put a simple alert() and check if it is fired. </li> <li>The controls are rendered on the page before referencing them in your JavaScript function </li> <li>If you are manually inserting the &lt;script&gt; tags – that you have set either the type (<strong>type=’text/javascript’</strong>) or the language (<strong>language=’javascript’</strong>) attributes. </li> </ol> <p>&nbsp;</p> <p>Georgi Tunev<br /> Telerik</p> http://blogs.telerik.com/SupportDept/Posts/09-05-05/executing_javascript_function_from_server-side_code.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-05-05/executing_javascript_function_from_server-side_code.aspx bfa7c51d-0f33-4406-9f90-ea2ee60285f5 Tue, 05 May 2009 09:43:26 GMT XML Syntax Rules <p><b>All XML Elements Must Have a Closing Tag</b> </p> <p>In HTML, you will often see elements that don't have a closing tag: </p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">p</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">This is a paragraph </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);"><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">p</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">This is another paragraph </span></td> </tr> <tr> <td> </td> </tr> </tbody> </table> </div> <br /> In XML, it is illegal to omit the closing tag. All elements <b>must </b>have a closing tag: <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">p</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">This is a paragraph</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">p</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);"><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">p</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">This is another paragraph</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">p</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">  </span></td> </tr> <tr> <td> </td> </tr> </tbody> </table> </div> <p> </p> <p> <b>Note</b>: You might have noticed from the previous example that the XML declaration did not have a closing tag. This is not an error. The declaration is not a part of the XML document itself, and it has no closing tag.<br /> <br /> <b>XML Tags are Case Sensitive </b></p> <p><b></b>XML elements are defined using XML tags.<br /> XML tags are case sensitive. With XML, the tag &lt;Letter&gt; is different from the tag &lt;letter&gt;.<br /> Opening and closing tags must be written with the same case: </p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">Message</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">This is incorrect</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">message</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);"><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">message</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">This is correct</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">message</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td> </td> </tr> </tbody> </table> </div> <p><b> Note:</b> "Opening and closing tags" are often referred to as "Start and end tags". Use whatever you prefer. It is exactly the same thing.<br /> <br /> <b>XML Elements Must be Properly Nested</b><br /> In HTML, you will often see improperly nested elements:</p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">b</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">&lt;</span><span style="font-weight: bold; color: #000000;">i</span><span style="font-size: 11px;">&gt;This text is bold and italic</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">b</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">&lt;/</span><span style="font-weight: bold; color: #000000;">i</span><span style="font-size: 11px;">&gt; </span></td> </tr> </tbody> </table> </div> <p> In XML, all elements <b>must </b>be properly nested within each other:</p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">b</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">&lt;</span><span style="font-weight: bold; color: #000000;">i</span><span style="font-size: 11px;">&gt;This text is bold and italic</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">i</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">&lt;/</span><span style="font-weight: bold; color: #000000;">b</span><span style="font-size: 11px;">&gt; </span></td> </tr> </tbody> </table> </div> <p> </p> <p>In the example above, "Properly nested" simply means that since the &lt;i&gt; element is opened inside the &lt;b&gt; element, it must be closed inside the &lt;b&gt; element.<br /> <br /> <b>XML Documents Must Have a Root Element</b><br /> XML documents must contain one element that is the <b>parent</b> of all other elements. This element is called the <b>root</b> element. </p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">root</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);">  <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">child</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td>    <span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">subchild</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">.....</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">subchild</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);">  <span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">child</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">root</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">  </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);"> </td> </tr> </tbody> </table> </div> <p><b> XML Attribute Values Must be Quoted</b><br /> XML elements can have attributes in name/value pairs just like in HTML.<br /> In XML the attribute value must always be quoted. Study the two XML documents below. The first one is incorrect, the second is correct:</p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">note </span><span style="color: #ff0000;">date</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">12</span><span style="font-size: 11px;">/11/2007</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);"><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">to</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">Tove</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">to</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">from</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">Jani</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">from</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);"><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">note</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td> </td> </tr> </tbody> </table> </div> <p> </p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">note </span><span style="color: #ff0000;">date</span><span style="font-size: 11px;">=</span><span style="color: #0000ff;">"12/11/2007"</span><span style="font-size: 11px;">&gt; </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);"><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">to</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">Tove</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">to</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">from</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">Jani</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">from</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td style="background-color: rgb(247,247,247);"><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">note</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> <tr> <td> </td> </tr> </tbody> </table> </div> <p> The error in the first document is that the date attribute in the note element is not quoted.<br /> <br /> <b>Entity References</b></p> <p> Some characters have a special meaning in XML.<br /> If you place a character like "&lt;" inside an XML element, it will generate an error because the parser interprets it as the start of a new element.<br /> This will generate an XML error:</p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">message</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">if salary </span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;"> </span><span style="font-weight: bold; color: #000000;">1000</span><span style="font-size: 11px;"> then</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">message</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> </tbody> </table> </div> <p> To avoid this error, replace the "&lt;" character with an <b>entity reference</b>:</p> <div style="border: rgb(127,157,185) 1px solid; font-family: courier new; background-color: white;"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: rgb(238,238,238) 0px solid; border-collapse: collapse; background-color: rgb(255,255,255); border-right-width: 0px;" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: rgb(247,247,247) 1px solid; font-family: courier new; white-space: nowrap;" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px;"></span><span style="color: #0000ff;">&lt;</span><span style="font-size: 11px;">message</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;">if salary &amp;lt; 1000 then</span><span style="color: #0000ff;">&lt;/</span><span style="font-size: 11px;">message</span><span style="color: #0000ff;">&gt;</span><span style="font-size: 11px;"> </span></td> </tr> </tbody> </table> </div> <p> </p> <p>There are 5 predefined entity references in XML:</p> <div id="RadEditorStyleKeeper2" style="display: none;"></div> <style reoriginalpositionmarker="RadEditorStyleKeeper2"> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:99; mso-style-unhide:no; mso-style-qformat:yes; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:.5in; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {mso-style-priority:99; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {mso-style-priority:99; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {mso-style-priority:99; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:.5in; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-fareast-font-family:Calibri; mso-hansi-font-family:Calibri;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <table style="border: gray 1pt solid;" cellspacing="0" cellpadding="0" width="50%" border="1"> <tbody> <tr> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">&amp;lt;</p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">&lt; </p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">less than</p> </td> </tr> <tr> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">&amp;gt;</p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">&gt; </p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">greater than</p> </td> </tr> <tr> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">&amp;amp;</p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">&amp;</p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">ampersand </p> </td> </tr> <tr> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">&amp;apos;</p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">'</p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">apostrophe</p> </td> </tr> <tr> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">&amp;quot;</p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">"</p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">quotation mark</p> </td> </tr> </tbody> </table> <p>   </p> <p><b> Note:</b> Only the characters "&lt;" and "&amp;" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it</p> <p><b> Comments in XML</b></p> The syntax for writing comments in XML is similar to that of HTML.<br /> &lt;!-- This is a comment --&gt; <p> </p> <p> <b>With XML, White Space is Preserved</b><br /> HTML reduces multiple white space characters to a single white space:  </p> <div id="RadEditorStyleKeeper3" style="display: none;"> </div> <style reoriginalpositionmarker="RadEditorStyleKeeper3"> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:99; mso-style-unhide:no; mso-style-qformat:yes; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:.5in; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {mso-style-priority:99; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {mso-style-priority:99; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {mso-style-priority:99; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:.5in; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-fareast-font-family:Calibri; mso-hansi-font-family:Calibri;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <table style="border: gray 1pt solid;" cellspacing="0" cellpadding="0" width="100%" border="1"> <tbody> <tr> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">HTML: </p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">Hello           my name is Tove </p> </td> </tr> <tr> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">Output: </p> </td> <td style="border: gray 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p style="margin-left: 0.25in;">Hello my name is Tove.</p> </td> </tr> </tbody> </table> <p> </p> <p>With XML, the white space in your document is not truncated.<br /> <br /> <b>XML Stores New Line as LF</b><br /> In Windows applications, a new line is normally stored as a pair of characters: carriage return (CR) and line feed (LF). The character pair bears some resemblance to the typewriter actions of setting a new line. In Unix applications, a new line is normally stored as a LF character. Macintosh applications use only a CR character to store a new line.</p> <p><b>Can XML use non-Latin characters?</b><br /> Yes, the XML Specification explicitly says XML uses ISO 10646, the international standard 31--bit character repertoire which covers most human (and some non-human) languages. This is currently congruent with Unicode and is planned to be superset of Unicode.</p> <p><em>The contents of this article were taken from the following w3schools page: </em><a href="http://www.w3schools.com/Xml/xml_syntax.asp"><em>http://www.w3schools.com/Xml/xml_syntax.asp</em></a><em>.</em></p> http://blogs.telerik.com/SupportDept/Posts/09-04-03/xml_syntax_rules.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-04-03/xml_syntax_rules.aspx bf2d1cca-9375-4043-abd6-338cfb6fd587 Fri, 03 Apr 2009 10:31:46 GMT XML DataSource - General information <p>The <b>XmlDataSource</b> control is a data source control that presents XML data to data-bound controls. The <b>XmlDataSource</b> control can be used by data-bound controls to display both hierarchical and tabular data. The <b>XmlDataSource</b> control is typically used to display hierarchical XML data in read-only scenarios. Because the <b>XmlDataSource</b> control extends the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.hierarchicaldatasourcecontrol(VS.80).aspx">HierarchicalDataSourceControl</a> class, it works with hierarchical data. The <b>XmlDataSource</b> control also implements the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.idatasource(VS.80).aspx">IDataSource</a> interface and works with tabular, or list-style, data.&#160; </p> <p>Page developers use the <b>XmlDataSource</b> control to display XML data using data-bound controls. </p> <p>The <b>XmlDataSource</b> typically loads XML data from an XML file, which is specified by the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.datafile(VS.80).aspx">DataFile</a> property. XML data can also be stored directly by the data source control in string form using the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.data(VS.80).aspx">Data</a> property. If you want to transform the XML data before it is displayed by a data-bound control, you can provide an Extensible Sylesheet Language (XSL) style sheet for the transformation. As with the XML data, you typically load the style sheet from a file, indicated by the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.transformfile(VS.80).aspx">TransformFile</a> property, but you can also store it in string form directly using the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.transform(VS.80).aspx">Transform</a> property.&#160; </p> <p>The <b>XmlDataSource</b> control is commonly used in read-only data scenarios where a data-bound control displays XML data. However, you can also use the <b>XmlDataSource</b> control to edit XML data. To edit the XML data, call the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.getxmldocument(VS.80).aspx">GetXmlDocument</a> method to retrieve an <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldatadocument(VS.80).aspx">XmlDataDocument</a> object that is an in-memory representation of the XML data. You can use the object model exposed by the <b>XmlDataDocument</b> and <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlnode(VS.80).aspx">XmlNode</a> objects it contains or use an XPath filtering expression to manipulate data in the document. When you have made changes to the in-memory representation of the XML data, you can save it to disk by calling the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.save(VS.80).aspx">Save</a> method.&#160; </p> <p>There are some restrictions to the editing capabilities of the <b>XmlDataSource</b> control: </p> <p>· The XML data must be loaded from an XML file that is indicated by the <b>DataFile</b> property, not from inline XML specified in the <b>Data</b> property.</p> <p>· No XSLT transformation can be specified in the <b>Transform</b> or <b>TransformFile</b> properties.</p> <p>· The <b>Save</b> method does not handle concurrent save operations by different requests. If more than one user is editing an XML file through the <b>XmlDataSource</b>, there is no guarantee that all users are operating with the same data. It is also possible for a <b>Save</b> operation to fail due to these same concurrency issues.</p> <p> A common operation performed with XML data is transforming it from one XML data set into another. The <b>XmlDataSource</b> control supports XML transformations with the <b>Transform</b> and <b>TransformFile</b> properties, which specify an XSL style sheet to apply to XML data before it is passed to a data-bound control, and the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.transformargumentlist(VS.80).aspx">TransformArgumentList</a> property, which enables you to supply dynamic XSLT style sheet arguments to be used by an XSL style sheet during the transformation. If you specify an XPath filtering expression using the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.xpath(VS.80).aspx">XPath</a> property, it is applied after the transformation takes place.</p> <p> By default, the <b>XmlDataSource</b> control loads all the XML data in the XML file identified by the <b>DataFile</b> property or found inline in the <b>Data</b> property, but you can filter the data using an XPath expression. The <b>XPath</b> property supports an XPath-syntax filter that is applied after XML data is loaded and transformed.</p> <p> For performance purposes, caching is enabled for the <b>XmlDataSource</b> control by default. Opening and reading an XML file on the server every time a page requested can reduce the performance of your application. Caching lets you reduce the processing load on your server at the expense of memory on the Web server; in most cases this is a good trade-off. The <b>XmlDataSource</b> automatically caches data when the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.enablecaching(VS.80).aspx">EnableCaching</a> property is set to <b>true</b>, and the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.cacheduration(VS.80).aspx">CacheDuration</a> property is set to the number of seconds that the cache stores data before the cache is invalidated. You can use the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.cacheexpirationpolicy(VS.80).aspx">CacheExpirationPolicy</a> to further fine-tune the caching behavior of the data source control.&#160; </p> <p> <table cellpadding="0" border="1"><tbody> <tr> <td valign="bottom"> <p><b>Capability</b></p> </td> <td valign="bottom"> <p><b>Description</b></p> </td> </tr> <tr> <td valign="top"> <p>Sorting</p> </td> <td valign="top"> <p>Not supported by the <b>XmlDataSource</b> control.</p> </td> </tr> <tr> <td valign="top"> <p>Filtering</p> </td> <td valign="top"> <p>The <b>XPath</b> property can be used to filter the XML data using an appropriate XPath expression.</p> </td> </tr> <tr> <td valign="top"> <p>Paging</p> </td> <td valign="top"> <p>Not supported by the <b>XmlDataSource</b> control.</p> </td> </tr> <tr> <td valign="top"> <p>Updating</p> </td> <td valign="top"> <p>Supported by manipulating the <b>XmlDataDocument</b> directly and then calling the <b>Save</b> method.</p> </td> </tr> <tr> <td valign="top"> <p>Deleting</p> </td> <td valign="top"> <p>Supported by manipulating the <b>XmlDataDocument</b> directly and then calling the <b>Save</b> method.</p> </td> </tr> <tr> <td valign="top"> <p>Inserting</p> </td> <td valign="top"> <p>Supported by manipulating the <b>XmlDataDocument</b> directly and then calling the <b>Save</b> method.</p> </td> </tr> <tr> <td valign="top"> <p>Caching</p> </td> <td valign="top"> <p>Enabled by default, with the <b>CacheDuration</b> property set to 0 (infinite) and the <b>CacheExpirationPolicy</b> property set to <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.datasourcecacheexpiry(VS.80).aspx">Absolute</a>.</p> </td> </tr> </tbody></table> </p> <p> Because the <b>XmlDataSource</b> control supports data-bound controls that display hierarchical data as well as controls that display tabular data, the data source control supports multiple types of data source view objects on its underlying XML data. The <b>XmlDataSource</b> control retrieves a single named <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasourceview(VS.80).aspx">XmlDataSourceView</a> object when used with a data-bound control that displays tabular data. The <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.idatasource.getviewnames(VS.80).aspx">GetViewNames</a> method identifies this single named view. When used with a data-bound control that displays hierarchical data, the <b>XmlDataSource</b> control retrieves an <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmlhierarchicaldatasourceview(VS.80).aspx">XmlHierarchicalDataSourceView</a> for any unique hierarchical path passed to the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.gethierarchicalview(VS.80).aspx">GetHierarchicalView</a> method.</p> http://blogs.telerik.com/SupportDept/Posts/09-03-26/xml_datasource_-_general_information.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-03-26/xml_datasource_-_general_information.aspx b047d0e9-cafc-4636-8c4a-b20268935df1 Thu, 26 Mar 2009 09:22:51 GMT JavaScript - Variables and Types Basics <p>This article is taken from <a href="http://en.wikibooks.org/wiki/JavaScript/Variables_and_Types">JavaScript @ Wikibooks</a>. </p> <p>JavaScript is a loosely typed language, this means that you don’t have to worry about setting the type of variable and you can change at will in runtime. But when you code, you have to make sure that you are getting the right type at the right time.</p> <p><u><font size="5">Variable declaration</font></u></p> <p>Variables are commonly explicitly declared the var statement, as shown below:</p> <pre class="csharpcode"><span class="kwrd">var</span> c;</pre> <style type="text/css"> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }</style> <p>The above variable is created, but has the default value of undefined. To be of value, the variable needs to be initialized: </p> <pre class="csharpcode"><span class="kwrd">var</span> c = 0;</pre> <p>Variables can also be created by assigning directly to them, which creates a global variable:</p> <pre class="csharpcode">c = 0;</pre> <p>The above is equivalent of assigning the variable to the window object:</p> <pre class="csharpcode">window.c = 0;</pre> <p>and creating such global variables is a practice that is best avoided.</p> <p><strong><font size="4">Naming variables</font></strong></p> <p>When naming variables there are some rules that must be obeyed:</p> <ul> <li>Upper case and lower case letters of the alphabet, underscores, and dollar signs can be used </li> <li>Numbers are allowed after the first character </li> <li>No other characters are allowed </li> <li>Variable names are case sensitive: different case implies a different name </li> <li>A variable may not be a reserved word </li> </ul> <p><u><font size="5">Primitive Types</font></u></p> <p>These are treated by Javascript as value types and when you pass them around they go as values. Some types, such as string, allow method calls.</p> <p><strong><font size="4">Boolean Type</font></strong></p> <p>Boolean variables can only have 2 possible values, true or false.</p> <div class="csharpcode"> <pre class="alt"><span class="kwrd">var</span> mayday = <span class="kwrd">false</span>; </pre> <pre><span class="kwrd">var</span> birthday = <span class="kwrd">true</span>;</pre> </div> <p><font size="4"><strong></strong></font></p> <p><font size="4"><strong>Numeric Types</strong></font></p> <p>You can use Integer and Float types on your variables, but they are treated as a numeric type.</p> <div class="csharpcode"> <pre class="alt"><span class="kwrd">var</span> sal = 20;</pre> <pre><span class="kwrd">var</span> pal = 12.1;</pre> </div> <p>In ECMA Javascript your number literals can go from 0 to -+1.79769e+308. And because 5e-324 is the smallest infinitesimal you can get, anything smaller is rounded to 0.</p> <p><font size="4"><strong>String Types</strong></font></p> <p>The String and char types are all strings, so you can build any string literal that you wished for.</p> <div class="csharpcode"> <pre class="alt"><span class="kwrd">var</span> myName = <span class="str">&quot;Some Name&quot;</span>; </pre> <pre><span class="kwrd">var</span> myChar = <span class="str">'d'</span>;</pre> </div> <p><font size="5"><u></u></font></p> <p><font size="5"><u>Complex Types</u></font></p> <p>A complex type is an object, be it either standard or custom made. Its home is the heap and goes everywhere by reference.</p> <p><font size="4"><strong>Array Type</strong></font></p> <p style="padding-left: 30px"><i>Main article: <a title="JavaScript/Arrays" href="/wiki/JavaScript/Arrays">JavaScript/Arrays</a></i></p> <p>In Javascript, all Arrays are untyped, so you can put everything you want in a Array and worry about that later. Arrays are objects, they have methods and properties you can invoke at will. (The &quot;.length&quot; property indicates how many things are currently in the array. If you add more things to the array, the value of the &quot;.length&quot; gets larger). You can build yourself an array by using the statement new followed by Array, as shown below:</p> <div class="csharpcode"> <pre class="alt"><span class="kwrd">var</span> myArray = <span class="kwrd">new</span> Array(0, 2, 4); </pre> <pre><span class="kwrd">var</span> myOtherArray = <span class="kwrd">new</span> Array(); </pre> </div> <p>Arrays can also be created with the array notation, which uses square brackets:</p> <div class="csharpcode"> <pre class="alt"><span class="kwrd">var</span> myArray = [0, 2, 4]; </pre> <pre><span class="kwrd">var</span> myOtherArray = [];</pre> </div> <p>Arrays are accessed using the square brackets:</p> <div class="csharpcode"> <pre class="alt">myArray[2] = <span class="str">&quot;Hello&quot;</span>;</pre> <pre><span class="kwrd">var</span> text = myArray[2];</pre> </div> <p>It is possible to have thousands of items in an array.</p> <p><font size="4"><strong>Object Types</strong></font></p> <p>An object within Javascript is created using the new operator:</p> <pre class="csharpcode"><span class="kwrd">var</span> myObject = <span class="kwrd">new</span> Object();</pre> <p>JavaScript Objects can be built using inheritance and overriding, and you can use polymorphism. There are no scope modifiers, with all properties and methods having public access. More information on creating objects can be found in <a href="http://en.wikibooks.org/wiki/JavaScript/Object_Oriented_Programming">Object Oriented Programming</a>.</p> <p>You can access browser built-in objects and objects provided through browser JavaScript extensions.</p> http://blogs.telerik.com/SupportDept/Posts/09-03-24/javascript_-_variables_and_types_basics.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-03-24/javascript_-_variables_and_types_basics.aspx 3e3e9d15-4c36-402b-8a6e-c3727ba90b0a Tue, 24 Mar 2009 11:25:00 GMT Client - side events in JavaScript <p style="margin: 0in 0in 10pt;"><span style="font-family: calibri;">Below is a table of the most common client side events in JavaScript. The Table is divided into three columns – the first lists the name of the event. The second contains a short description of the event, and the third lists all page objects, which support the given event.</span><b><i><span style="font-family: calibri;">                                          </span></i></b></p> <p style="margin: 0in 0in 10pt;"> <table style="border: medium none; border-collapse: collapse;" cellspacing="0" cellpadding="0" border="1"> <thead> </thead> <tbody> <tr> <td style="border: windowtext 1pt solid; background-color: transparent; text-align: center;"><strong><em><span style="font-family: calibri;">Event Name</span></em></strong></td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"><strong><em><span style="font-family: calibri;">               Description </span></em></strong></td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"><strong><em><span style="font-family: calibri;">Supported by objects</span></em></strong></td> </tr> <tr> <td style="border: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';"> onabort</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onabort event occurs when loading of an image is aborted.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">image</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onblur</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onblur event occurs when an object loses focus.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">button, checkbox, fileUpload, layer, frame, password, radio, reset, submit, text, textarea, window</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onchange</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onchange event occurs when the content of a field changes.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">fileUpload, select, text, textarea</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onclick</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onclick event occurs when an object gets clicked.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">button, document, checkbox, link, radio, reset, submit</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">ondblclick</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The ondblclick event occurs when an object gets double-clicked.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">document, link</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onerror</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onerror event is triggered when an error occurs loading a document or an image.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">window, image</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onfocus</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onfocus event occurs when an object gets focus.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">button, checkbox, fileUpload, layer, frame, password, radio, reset, select, submit, text, textarea, window</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onkeydown</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 0pt;"><span style="font-family: 'times new roman','serif';">The onkeydown event occurs when a keyboard key is pressed.</span></p> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';"> </span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">document, image, link, textarea</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onkeypress</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onkeydown event occurs when a keyboard key is pressed or held down.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">document, image, link, textarea</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onkeyup</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onkeyup event occurs when a keyboard key is released.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">document, image, link, textarea</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onload</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onload event occurs immediately after a page or an image is loaded.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">image, layer, window</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onmousedown</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onmousedown event occurs when a mouse button is clicked.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">button, document, link</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onmousemove</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 0pt;"><span style="font-family: 'times new roman','serif';">The onmousemove event occurs when the mouse pointer is moved.</span></p> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';"> </span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onmousemove is, by default, not an event of any object, because mouse movement happens very frequently.</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onmouseout</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onmouseout event occurs when the mouse pointer moves away from a specified object.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">layer, link</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onmouseover</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onmouseover event occurs when the mouse pointer moves over a specified object.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">layer, link</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onmouseup</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onmouseup event occurs when a mouse button is released.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">button, document, link</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onreset</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onreset event occurs when the reset button in a form is clicked.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">Form</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onresize</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onresize event occurs when a window or frame is resized.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">Window</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onselect</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onselect event occurs when text is selected in a text or textarea field.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">text, textarea</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onsubmit</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">The onsubmit event occurs when the submit button in a form is clicked.</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">Form</span></p> </td> </tr> <tr> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 1.2in; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">onunload</span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 286.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 0pt;"><span style="font-family: 'times new roman','serif';">The onunload event occurs when a user exits a page.</span></p> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';"> </span></p> </td> <td style="border: windowtext 1pt solid;border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #d4d0c8; padding-left: 5.4pt; padding-bottom: 0in; border-left: #d4d0c8; width: 186.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent;" valign="top"> <p style="margin: 0in 0in 10pt;"><span style="font-family: 'times new roman','serif';">window</span></p> </td> </tr> </tbody> </table> </p> http://blogs.telerik.com/SupportDept/Posts/09-02-27/client_-_side_events_in_javascript.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-02-27/client_-_side_events_in_javascript.aspx 5baf7ebc-8a8b-4992-9ea5-8396875f2e25 Fri, 27 Feb 2009 08:13:23 GMT Hiding JavaScript code from old browsers <p>Sometimes we need to hide the <em>JavaScript</em> code from the old browsers that do not support it.</p> <p>To prevent old browsers from displaying your <em>JS</em> code, do the following: </p> <p>&nbsp;</p> <p>Immediately after the opening <code><span style="color: rgb(128, 128, 128);">&lt;script&gt;</span></code> tag, put a one-line <em>HTML</em>-style comment without the closing characters, so that the first two lines of your script would look like this: </p> <pre><span style="color: rgb(0, 0, 255);">&lt;script language="JavaScript"&gt;<br />&lt;!--</span></pre> <pre><span style="color: rgb(0, 0, 255);"></span> </pre> At the end of your script, put the following two lines: <pre><span style="color: rgb(0, 0, 255);">//--&gt;<br />&lt;/script&gt;</span></pre> <pre><span style="color: rgb(0, 0, 255);"></span> </pre> <p>Thus, your <em>HTML</em> file will contain the following fragment: </p> <table width="400" cellspacing="0" cellpadding="0" border="1" class="MsoTableGrid" style="border: medium none ; margin-left: 0.25pt; width: 299.9pt; border-collapse: collapse;" unselectable="on"> <tbody> <tr> <td width="400" valign="top" style="border: medium none ; padding: 0in 5.4pt; background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 299.9pt;"> <p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal;"><span style="font-size: 12pt; font-family: 'courier new'; color: blue;">&lt;script language="JavaScript"&gt; <br /> &lt;!--</span><span style="font-size: 12pt; font-family: 'courier new'; color: rgb(64, 128, 128);"> <br /> </span><em><span style="font-size: 12pt; font-family: 'courier new'; color: green;">&nbsp;&nbsp;&nbsp; Put your JS code here. Old </span></em></p> <p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal;"><em><span style="font-size: 12pt; font-family: 'courier new'; color: green;">&nbsp;&nbsp;&nbsp; browsers will treat it as regular </span></em></p> <p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal;"><em><span style="font-size: 12pt; font-family: 'courier new'; color: green;">&nbsp;&nbsp;&nbsp; HTML comment.</span></em><span style="font-size: 12pt; font-family: 'courier new'; color: rgb(64, 128, 128);"> <br /> </span><span style="font-size: 12pt; font-family: 'courier new'; color: blue;">//--&gt; <br /> &lt;/script&gt;</span><span style="font-size: 12pt; font-family: 'times new roman','serif';"><o:p></o:p></span></p> </td> </tr> </tbody> </table> <p>&nbsp;</p> <pre></pre> <p>Old browsers will treat your <em>JavaScript</em> code as one long <em>HTML</em> comment. On the other hand, new <em>JavaScript</em>-aware browsers will normally interpret the code between the tags <code>&lt;script&gt;</code> and <code>&lt;/script&gt;</code> (the first and last lines of the code will be treated by the <em>JavaScript</em> interpreter as one-line comments). </p> <em><a href="http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/guide/embed.html" target="_blank">Embedding JavaScript in HTML</a></em> http://blogs.telerik.com/SupportDept/Posts/09-02-13/hiding_javascript_code_from_old_browsers.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-02-13/hiding_javascript_code_from_old_browsers.aspx 901b353c-c401-4708-8a6e-f6561a30ff58 Fri, 13 Feb 2009 12:12:36 GMT Chainability (The Magic of jQuery) <p>This article is taken from <a href="http://docs.jquery.com/How_jQuery_Works" target="_blank">How jQuery Works</a>.</p> <p>&#160;</p> <p>jQuery uses an interesting concept called a &quot;Builder&quot; to make its code short and simple. The Builder pattern is an object-oriented programming design pattern that has been gaining popularity. </p> <p>In a nutshell: Every method within jQuery returns the query object itself, allowing you to 'chain' upon it, for example: </p> <pre class="csharpcode">$(<span class="str">&quot;a&quot;</span>) .filter(<span class="str">&quot;.clickme&quot;</span>) .click(<span class="kwrd">function</span>(){ alert(<span class="str">&quot;You are now leaving the site.&quot;</span>); }) .end() .filter(<span class="str">&quot;.hideme&quot;</span>) .click(<span class="kwrd">function</span>(){ $(<span class="kwrd">this</span>).hide(); <span class="kwrd">return</span> <span class="kwrd">false</span>; }) .end();</pre> <pre class="csharpcode">&#160;</pre> <p>Which would work against the following HTML: </p> <pre class="csharpcode">&lt;a href=<span class="str">&quot;http://google.com/&quot;</span> <span class="kwrd">class</span>=<span class="str">&quot;clickme&quot;</span>&gt;I give a message when you leave&lt;/a&gt; &lt;a href=<span class="str">&quot;http://yahoo.com/&quot;</span> <span class="kwrd">class</span>=<span class="str">&quot;hideme&quot;</span>&gt;Click me to hide!&lt;/a&gt; &lt;a href=<span class="str">&quot;http://microsoft.com&quot;</span>&gt;I'm a normal link&lt;/a&gt;</pre> <style type="text/css"> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }</style> <p>Methods that modify the jQuery selection and can be undone with <code>end()</code>, are the following:</p> <ul> <li><code>add()</code>, </li> <li><code>children()</code>, </li> <li><code>eq()</code>, </li> <li><code>filter()</code>, </li> <li><code>find()</code>, </li> <li><code>gt()</code>, </li> <li><code>lt()</code>, </li> <li><code>next()</code>, </li> <li><code>not()</code>, </li> <li><code>parent()</code>, </li> <li><code>parents()</code> and </li> <li><code>siblings()</code>. </li> </ul> <p>Please check the <a href="http://docs.jquery.com/Traversing">Traversing API documentation</a> for details of these methods.</p> <p>&#160;</p> <p>Peter</p> http://blogs.telerik.com/SupportDept/Posts/09-02-06/chainability_the_magic_of_jquery.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-02-06/chainability_the_magic_of_jquery.aspx 13f4dd58-6d93-45c2-aaf1-bad09d797fdb Fri, 06 Feb 2009 15:36:00 GMT JavaScript Timing Events <p>This article is taken from <a href="http://www.w3schools.com/js/js_timing.asp">W3Schools</a>. </p> <p> </p> <p>With JavaScript, it is possible to execute some code NOT immediately after a function is called, but after a specified time interval. This is called timing events.</p> <p>It's very easy to time events in JavaScript. The two key methods that are used are:</p> <ul> <li><strong>setTimeout()</strong> - executes a code some time in the future </li> <li><strong>clearTimeout()</strong> - cancels the setTimeout() </li> </ul> <p><strong>setTimeout()<br /> </strong>Syntax</p> <div style="border-right: #7f9db9 1px solid; border-top: #7f9db9 1px solid; font-size: 11px; overflow: auto; border-left: #7f9db9 1px solid; line-height: 100%! important; border-bottom: #7f9db9 1px solid; font-family: courier new; background-color: white"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: #eee 0px solid; border-collapse: collapse; background-color: #fff; border-right-width: 0px" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: #f7f7f7 1px solid; font-family: courier new; white-space: nowrap" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px"></span><span style="color: #0000ff">var</span><span style="font-size: 11px"> t=setTimeout(</span><span style="color: #0000ff">"javascript statement"</span><span style="font-size: 11px">,milliseconds); </span></td> </tr> </tbody> </table> </div> <p>The <strong>setTimeout()</strong> method returns a value - In the statement above, the value is stored in a variable called t. If you want to cancel this <strong>setTimeout()</strong>, you can refer to it using the variable name.</p> <p>The first parameter of <strong>setTimeout()</strong> is a string that contains a JavaScript statement. This statement could be a statement like "alert('5 seconds!')" or a call to a function, like "alertMsg()".</p> <p>The second parameter indicates how many milliseconds from now you want to execute the first parameter. </p> <p>Note: There are 1000 milliseconds in one second.</p> <p><strong>Example</strong>:<br /> When the button is clicked in the example below, an alert box will be displayed after 5 seconds.</p> <div style="border-right: #7f9db9 1px solid; border-top: #7f9db9 1px solid; font-size: 11px; overflow: auto; border-left: #7f9db9 1px solid; line-height: 100%! important; border-bottom: #7f9db9 1px solid; font-family: courier new; background-color: white"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: #eee 0px solid; border-collapse: collapse; background-color: #fff; border-right-width: 0px" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: #f7f7f7 1px solid; font-family: courier new; white-space: nowrap" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px"></span><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">html</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">head</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td> </td> </tr> <tr> <td style="background-color: #f7f7f7">    <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">script </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"text/javascript"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td>    function timedMsg()  </td> </tr> <tr> <td style="background-color: #f7f7f7">    {  </td> </tr> <tr> <td>        var <span style="color: #ff0000">t</span><span style="font-size: 11px">=</span><span style="color: #0000ff">setTimeout</span><span style="font-size: 11px">("alert('5 seconds!')",5000);  </span></td> </tr> <tr> <td style="background-color: #f7f7f7">    }  </td> </tr> <tr> <td>    <span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">script</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"> </td> </tr> <tr> <td><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">head</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">body</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td>    <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">form</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7">        <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">input </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"button"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">value</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"Display timed alertbox!"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">onclick</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"timedMsg()"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td>    <span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">form</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">body</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">html</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> </tbody> </table> </div> <p> </p> <p>Example - Infinite Loop</p> <p>To get a timer to work in an infinite loop, we must write a function that calls itself. In the example below, when the button is clicked, the input field will start to count (forever), starting at 0:</p> <div style="border-right: #7f9db9 1px solid; border-top: #7f9db9 1px solid; font-size: 11px; overflow: auto; border-left: #7f9db9 1px solid; line-height: 100%! important; border-bottom: #7f9db9 1px solid; font-family: courier new; background-color: white"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: #eee 0px solid; border-collapse: collapse; background-color: #fff; border-right-width: 0px" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: #f7f7f7 1px solid; font-family: courier new; white-space: nowrap" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px"></span><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">html</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">head</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td>    <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">script </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"text/javascript"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7">    var <span style="color: #ff0000">c</span><span style="font-size: 11px">=</span><span style="color: #0000ff">0</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td>    var t  </td> </tr> <tr> <td style="background-color: #f7f7f7">    function timedCount()  </td> </tr> <tr> <td>    {  </td> </tr> <tr> <td style="background-color: #f7f7f7">        document.getElementById('txt')<span style="color: #ff0000">.value</span><span style="font-size: 11px">=</span><span style="color: #0000ff">c</span><span style="font-size: 11px">;  </span></td> </tr> <tr> <td>        <span style="color: #ff0000">c</span><span style="font-size: 11px">=c+1;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7">        <span style="color: #ff0000">t</span><span style="font-size: 11px">=</span><span style="color: #0000ff">setTimeout</span><span style="font-size: 11px">("timedCount()",1000);  </span></td> </tr> <tr> <td>    }  </td> </tr> <tr> <td style="background-color: #f7f7f7">    <span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">script</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">head</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">body</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td>    <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">form</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7">        <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">input </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"button"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">value</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"Start count!"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">onclick</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"timedCount()"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td>        <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">input </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"text"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">id</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"txt"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7">    <span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">form</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">body</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">html</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> </tbody> </table> </div> <p> </p> <p> </p> <p><strong>clearTimeout()<br /> </strong>Syntax</p> <div style="border-right: #7f9db9 1px solid; border-top: #7f9db9 1px solid; font-size: 11px; overflow: auto; border-left: #7f9db9 1px solid; line-height: 100%! important; border-bottom: #7f9db9 1px solid; font-family: courier new; background-color: white"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: #eee 0px solid; border-collapse: collapse; background-color: #fff; border-right-width: 0px" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: #f7f7f7 1px solid; font-family: courier new; white-space: nowrap" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px">clearTimeout(setTimeout_variable) </span></td> </tr> </tbody> </table> </div> <p> </p> <p><strong>Example<br /> </strong>The example below is the same as the "Infinite Loop" example above. The only difference is that we have now added a "Stop Count!" button that stops the timer:</p> <div style="border-right: #7f9db9 1px solid; border-top: #7f9db9 1px solid; font-size: 11px; overflow: auto; border-left: #7f9db9 1px solid; line-height: 100%! important; border-bottom: #7f9db9 1px solid; font-family: courier new; background-color: white"> <table style="border-top-width: 0px; border-left-width: 0px; margin: 2px 0px; width: 99%; border-bottom: #eee 0px solid; border-collapse: collapse; background-color: #fff; border-right-width: 0px" cellspacing="0" cellpadding="0"> <colgroup><col style="padding-left: 10px; font-size: 11px; border-bottom: #f7f7f7 1px solid; font-family: courier new; white-space: nowrap" /></colgroup> <tbody> <tr> <td><span style="font-size: 11px"></span><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">html</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">head</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td> </td> </tr> <tr> <td style="background-color: #f7f7f7">    <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">script </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"text/javascript"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td>    var <span style="color: #ff0000">c</span><span style="font-size: 11px">=</span><span style="color: #0000ff">0</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7">    var t  </td> </tr> <tr> <td>    function timedCount()  </td> </tr> <tr> <td style="background-color: #f7f7f7">    {  </td> </tr> <tr> <td>        document.getElementById('txt')<span style="color: #ff0000">.value</span><span style="font-size: 11px">=</span><span style="color: #0000ff">c</span><span style="font-size: 11px">;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7">        <span style="color: #ff0000">c</span><span style="font-size: 11px"></span><span style="color: #0000ff">c</span><span style="font-size: 11px">=c+1;  </span></td> </tr> <tr> <td>        <span style="color: #ff0000">t</span><span style="font-size: 11px">=</span><span style="color: #0000ff">setTimeout</span><span style="font-size: 11px">("timedCount()",1000);  </span></td> </tr> <tr> <td style="background-color: #f7f7f7">    }  </td> </tr> <tr> <td> </td> </tr> <tr> <td style="background-color: #f7f7f7">    function stopCount()  </td> </tr> <tr> <td>    {  </td> </tr> <tr> <td style="background-color: #f7f7f7">        clearTimeout(t);  </td> </tr> <tr> <td>    }  </td> </tr> <tr> <td style="background-color: #f7f7f7">    <span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">script</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td> </td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">head</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td><span style="color: #0000ff">&lt;</span><span style="font-size: 11px">body</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7">    <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">form</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td>        <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">input </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"button"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">value</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"Start count!"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">onclick</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"timedCount()"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7">        <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">input </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"text"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">id</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"txt"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td>        <span style="color: #0000ff">&lt;</span><span style="font-size: 11px">input </span><span style="color: #ff0000">type</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"button"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">value</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"Stop count!"</span><span style="font-size: 11px"> </span><span style="color: #ff0000">onclick</span><span style="font-size: 11px">=</span><span style="color: #0000ff">"stopCount()"</span><span style="font-size: 11px">&gt;  </span></td> </tr> <tr> <td style="background-color: #f7f7f7">    <span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">form</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">body</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> <tr> <td style="background-color: #f7f7f7"><span style="color: #0000ff">&lt;/</span><span style="font-size: 11px">html</span><span style="color: #0000ff">&gt;</span><span style="font-size: 11px"> </span></td> </tr> </tbody> </table> </div> <p> </p> <p>Note: The <strong>setTimeout()</strong> and <strong>clearTimeout()</strong> are both methods of the HTML DOM Window object.</p> http://blogs.telerik.com/SupportDept/Posts/09-01-30/javascript_timing_events.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-01-30/javascript_timing_events.aspx f536789b-9276-4b37-95c2-f2f8d5e37150 Fri, 30 Jan 2009 07:23:27 GMT Encode and Decode strings using JavaScript <p>In order for a string to be read from all computers sometimes it is useful to encode and decode it. This can be easily achieved using the JavaScript built-in <b>escape()</b> and <b>unescape()</b> methods. Both the <b>escape()</b> and the <b>unescape()</b> methods have the same argument – the string which will be escaped or unescaped.</p> <p>The <b>escape()</b> method returns a string value (in Unicode format) that represents the encoded contents of the function argument. All spaces, punctuation, accented characters, and any other non-ASCII characters are replaced with <b><i>%xx</i></b> encoding, where <b><i>xx</i></b> is equivalent to the hexadecimal number representing the character. </p> <p>For example, a space is returned as &quot;%20&quot;. </p> <p>Additionally, having a code segment like:</p> <p>document.write(escape(&quot;Test \n escapeText \b&quot;));</p> <p>would yield a result like the following:</p> <p>Test%20%0A% escapeText %20%08</p> <p>As shown, the spaces are represented by &quot;%20&quot;, whereas the newline and backspace are represented by “%0A” and “%08”.All other characters, which bear no special meaning, are left intact. </p> <p>The <b>escape()</b> function will encode special characters with the exception of the following:</p> <p>* @ - _ + . /</p> <p>The <b>unescape()</b> method returns a string value that represents the argument passed to the function, converted to normal characters. All characters encoded with the %xx hexadecimal form are replaced by their ASCII character set equivalents. </p> <p>The <b>escape</b>() and <b>unescape</b>() functions should not be used to encode or decode URIs. </p> <p>If one needs to encode/encode URIs, the <b>encodeURI</b>() and <b>decodeURI</b>() methods should be used. These two last methods encode all but the following characters:</p> <p>: / ; ?</p> <p>If the necessity to encode all characters arises, one can take advantage of the <b>encodeURIComponent</b>() method. Because the <b>encodeURIComponent()</b> method encodes all characters, it should be used carefully. For example, if the string represents a path such as /baseFolder/folder1/default.html, the slash characters will be encoded and will not be valid if sent as a request to a web server.</p> <p>More information on the use of <b>encodeURI()</b>, <b>decodeURI()</b> and <b>encodeURIComponent</b>() methods is available in the following blog <a href="http://blogs.telerik.com/supportdept/posts/09-01-08/Encode_and_Decode_URI_Uniform_Resource_Identifier_using_JavaScript.aspx" target="_blank">post</a>.</p> <p>Yavor Angelov</p> http://blogs.telerik.com/SupportDept/Posts/09-01-15/encode_and_decode_strings_using_javascript.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-01-15/encode_and_decode_strings_using_javascript.aspx 68a5b81d-ec01-4436-8c1d-d102cc778e23 Thu, 15 Jan 2009 03:30:43 GMT Encode and Decode URI(Uniform Resource Identifier) using JavaScript <p>The current article is taken from <a href="https://developer.mozilla.org/" target="_blank">https://developer.mozilla.org/</a></p> <p>In some scenarios it is useful to encode and decode the URI. For example:</p> <p>To avoid unexpected requests to the server, you should call <code>encodeURIComponent</code> on any user-entered parameters that will be passed as part of a URI. For example, a user could type "<kbd>Thyme &amp;time=again</kbd>" for a variable <code>comment</code>. Not using <code>encodeURIComponent</code> on this variable will give <code>comment=Thyme%20&amp;time=again</code>. Note that the ampersand and the equal sign mark a new key and value pair. So instead of having a POST <code>comment</code> key equal to "<kbd>Thyme &amp;time=again</kbd>", you have two POST keys, one equal to "<kbd>Thyme </kbd>" and another (<code>time</code>) equal to <kbd>again</kbd>.</p> <p><code></code></p> <p><code><strong><span style="text-decoration: underline"></span></strong></code></p> <p><code><strong><span style="text-decoration: underline">encodeURIComponent</span></strong></code> </p> <p><strong>Core Function</strong>: </p> <p>Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, or three escape sequences representing the UTF-8 encoding of the character.</p> <p><strong>Syntax</strong></p> <p>var encoded = encodeURIComponent(<i>str</i>);</p> <p align="left"><strong>Parameters</strong></p> <p align="left">&nbsp;</p> <dl><dt><code>str - </code>A component of a URI. </dt></dl> <p>&nbsp;</p> <p><strong>Description</strong></p> <p><code>encodeURIComponent</code> escapes all characters except the following: </p> <p>alphabetic, decimal digits, <code>- _ . ! ~ * ' ( )</code></p> <p><strong>Example</strong> </p> <p>If we encode the URL of this blog:</p> <pre class="csharpcode">&lt;script type=<span class="str">"text/javascript"</span>&gt; document.write(encodeURIComponent(<span class="str">"http://blogs.telerik.com/SupportDept/Posts.aspx"</span>)); &lt;/script&gt;</pre> <style type="text/css"> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> <p>we will get the following result:</p> <p>http%3A%2F%2Fblogs.telerik.com%2FSupportDept%2FPosts.aspx</p> <p> </p> <p><code><strong><span style="text-decoration: underline">decodeURIComponent</span></strong></code> </p> <p><strong>Description</strong></p> <p>Replaces each escape sequence in the encoded URI component with the character that it represents.</p> <p><b>Core Function</b></p> <p>Decodes a Uniform Resource Identifier (URI) component previously created by <code>encodeURIComponent</code> or by a similar routine. </p> <h5><strong>Syntax</strong> </h5> <p><code>decodeURIComponent(<i>encodedURI</i>) </code></p> <h5><strong>Parameters</strong> </h5> <dl><dt><code>encodedURI - </code>An encoded component of a Uniform Resource Identifier. </dt></dl> <p><strong></strong></p> <p><strong>Example</strong></p> <p>We can decode the previously encoded URL to get its original value:</p> <pre class="csharpcode">&lt;script type=<span class="str">"text/javascript"</span>&gt; <span class="kwrd">var</span> url = encodeURIComponent(<span class="str">"http://blogs.telerik.com/SupportDept/Posts.aspx"</span>); document.write(url); document.write(<span class="str">"&lt;br /&gt;"</span>); document.write(decodeURIComponent(url)); &lt;/script&gt;</pre> <style type="text/css"> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> <p> </p> <p>Vesselin Vasilev</p> http://blogs.telerik.com/SupportDept/Posts/09-01-08/encode_and_decode_uri_uniform_resource_identifier_using_javascript.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/09-01-08/encode_and_decode_uri_uniform_resource_identifier_using_javascript.aspx 2e9f5083-7468-4943-82e8-2cb6368ca115 Thu, 08 Jan 2009 09:12:55 GMT New support resources search facilities on telerik.com <p>Greetings everyone,</p> <p>With the brand new look-and-feel of telerik.com we introduced for the <a href="http://www.telerik.com/company/press-center/company-news/q3-2008-release-announced.aspx">landmark Q3 2008 release</a> you probably noticed that the support resources searching capabilities have changed, too. Our aim was to expose intuitive and straight-forward means to browse the available resources based on their type and find the information/examples you need in a blink of an eye. In a nutshell, we would like each visitor to have the ability to search by product line and get a list of results with a leading indicator image designating the resource type (demo, help topic, knowledge base article, code library project, etc.).</p> <p>Since a well-organized set of screen shots speaks for itself, let's get to the point and explain some of the options you have when looking for some piece of information/code example concerning a particular implementation of yours.</p> <p> <br />The first step is to go to the 'Support' section on telerik.com: <br /> <br /><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-supportHome.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="101" alt="supportHome" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-supportHome_thumb.sflb" width="244" border="0" /></a> </p> <p>&#160; <br />From there you can choose a specific product line you are interested in: <br /> <br /><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ProductLines.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="ProductLines" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ProductLines_thumb.sflb" width="238" border="0" /></a> <br /> <br />For our simple test let's choose 'ASP.NET AJAX Controls'. We will be instantly navigated to the following section:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ASPNETAJAXControls.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="ASPNETAJAXControls" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ASPNETAJAXControls_thumb.sflb" width="179" border="0" /></a>&#160; <br /> <br />where one can choose to browse the resources for our ASP.NET AJAX controls in general, a particular RadControl or explore all support resources for a given product line/specific control based on their type (see the '<em>Or, just check...</em>' panel in the screen shot).&#160; <br /> <br />Here is the place to note that this page (as well as the pages for individual controls sources) have unified appearance/sections. This means that once the end user gets familiar with the layout of a single search page, he/she will be able to navigate quite easily through an arbitrary control support page from a product line of his/her choice. Pretty useful, eh?!</p> <p>Back to the main subject - let's type 'performance' in the input field at the top and press the 'Search' button beside it. Here are the results returned by the filter criteria we just entered (having a slick icon in front of each entry that indicates the actual type of the resource):</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-PerformanceSearch.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="207" alt="PerformanceSearch" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-PerformanceSearch_thumb.sflb" width="244" border="0" /></a> <br /> <br />Worth to mention is that there is a helpful panel in the right section of the result page which allows you to filter the listed items by their type if you would like to enforce an additional filtering rule and limit the results array. <br /> <br />Now, what if I would like to get some information about a concrete control? This has never been that easy as it is currently. Simply navigate back to the support home page with the product lines and drill down as deep as you want to go. For example, let's choose 'ASP.NET AJAX controls' -&gt; Menu: <br /> <br /><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ASPNETAJAXMenu.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="ASPNETAJAXMenu" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ASPNETAJAXMenu_thumb.sflb" width="231" border="0" /></a>&#160;&#160; <br /> <br />You will be directed to the page below:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ASPNETAJAXMenuSearchPage1.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="126" alt="ASPNETAJAXMenuSearchPage1" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ASPNETAJAXMenuSearchPage1_thumb.sflb" width="244" border="0" /></a> <br /> <br /><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ASPNETAJAXMenuSearchPage2.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="189" alt="ASPNETAJAXMenuSearchPage2" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ASPNETAJAXMenuSearchPage2_thumb.sflb" width="244" border="0" /></a> <br /> <br />As you can see, the most important sources are listed at the top (Demos, Online Help, Step-by-step tutorial) followed by 'Recent Tips' and 'Popular resources' modules in which the content is gathered based on the principle &quot;What you should know about [RadControl]&quot;&#160; and grouped by categories. Naturally, you have the well-known search facility concerned previously in this post (together with the filter panel at the right side) and just for better visualization I am providing a screen shot from a quick search after entering 'menu item' in the input area:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-MenuItemSearch.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="197" alt="MenuItemSearch" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-MenuItemSearch_thumb.sflb" width="244" border="0" /></a> <br /></p> <p>Additionally, you are free to use (and abuse :)) the stand-alone search options in the demos, online documentation, knowledge base, code library and forums available in previous versions as well:</p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-OnlineDemosSearch.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="185" alt="OnlineDemosSearch" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-OnlineDemosSearch_thumb.sflb" width="244" border="0" /></a> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-OnlineHelpSearch.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="98" alt="OnlineHelpSearch" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-OnlineHelpSearch_thumb.sflb" width="244" border="0" /></a> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-KnowledgeBaseSearch.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="169" alt="KnowledgeBaseSearch" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-KnowledgeBaseSearch_thumb.sflb" width="244" border="0" /></a> </p> <p><a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-CodeLibrarySearch.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="CodeLibrarySearch" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-CodeLibrarySearch_thumb.sflb" width="229" border="0" /></a> <a href="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ForumsSearch.sflb"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="175" alt="ForumsSearch" src="http://blogs.telerik.com/Libraries/MetaBlogLib/WindowsLiveWriter-9cd98148589a_E4F2-ForumsSearch_thumb.sflb" width="244" border="0" /></a> <br /> <br />An entire universe of search capabilities created to make the life of the developer easier, don't you think?! Which option would you prefer or find best? <br /> <br />Happy searching and happy holidays!</p> <p>Stefan</p> http://blogs.telerik.com/SupportDept/Posts/08-12-22/new_support_resources_search_facilities_on_telerik_com.aspx Support Dept http://blogs.telerik.com/SupportDept/Posts/08-12-22/new_support_resources_search_facilities_on_telerik_com.aspx 36252981-aa64-453a-afd0-7d9cc309a8cc Mon, 22 Dec 2008 10:16:55 GMT