<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.clyxstudios.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>clyx development blog : Javascript</title><link>http://www.clyxstudios.com/blogs/development/archive/tags/Javascript/default.aspx</link><description>Tags: Javascript</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>You too can have fancy tooltips</title><link>http://www.clyxstudios.com/blogs/development/archive/2006/06/26/You-too-can-have-fancy-tooltips.aspx</link><pubDate>Tue, 27 Jun 2006 05:57:00 GMT</pubDate><guid isPermaLink="false">ce91e018-d46e-43ff-806c-101a08402f3c:38</guid><dc:creator>admin</dc:creator><slash:comments>14</slash:comments><comments>http://www.clyxstudios.com/blogs/development/comments/38.aspx</comments><wfw:commentRss>http://www.clyxstudios.com/blogs/development/commentrss.aspx?PostID=38</wfw:commentRss><wfw:comment>http://www.clyxstudios.com/blogs/development/rsscomments.aspx?PostID=38</wfw:comment><description>&lt;p&gt;I had a fairly busy web page that I thought could be streamlined through the use of popups or tooltips (no, not the standard &lt;font style="BACKGROUND-COLOR: #ffff00"&gt;yellow&lt;/font&gt; ones!). I was also keen on including images in the tooltips as well, to make them a little more interesting. So I thought about writing my own Javascript &amp;amp; DHTML library, but quickly abandoned that idea, deciding not to reinvent the wheel. Instead, some googling revealed a &lt;a href="http://www.walterzorn.com/tooltip/tooltip_e.htm" target=_blank&gt;wonderful little library&lt;/a&gt; called &lt;strong&gt;wz_tooltips.js&lt;/strong&gt; from &lt;a href="http://www.walterzorn.com/"&gt;Walter Zorn&lt;/a&gt; and it does just what I need. &lt;/p&gt;
&lt;p&gt;It looked pretty simple to add this libary into Community Server so I thought about the most logical place to put it, and drag-and-dropped it to the utility directory in the Web Visual Studio project. &lt;em style="COLOR: #808080"&gt;"A file with the name utility/wz_tooltips.js already exists."&lt;/em&gt;. Huh??.... Did I already do that?.... Before I signed myself up for some more &lt;a href="http://www.braintraining.com.au/"&gt;brain training&lt;/a&gt;, I double-checked the Community Server deployment files. Turns out the guys at Telligent had obviously done their research too and already used the wz_tooltips library for CS tooltips. &lt;/p&gt;
&lt;p&gt;So here's a really easy way to add your own tooltips to your pages in Community Server. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Include a call to JavaScript.RegisterToolTips in your Page_Load handler eg. 
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;div style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Consolas"&gt;
&lt;p style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: maroon"&gt;script&lt;/span&gt; &lt;span style="COLOR: red"&gt;language&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="C#"&lt;/span&gt; &lt;span style="COLOR: red"&gt;runat&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="server"&amp;gt; &lt;br /&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;void&lt;/span&gt; Page_Load(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: teal"&gt;EventArgs&lt;/span&gt; e) { &lt;br /&gt;&lt;span style="COLOR: teal"&gt;JavaScript&lt;/span&gt;.RegisterToolTips(&lt;span style="COLOR: blue"&gt;this&lt;/span&gt;); &lt;br /&gt;} &lt;br /&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: maroon"&gt;script&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/p&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/li&gt;
&lt;li&gt;On each element that you want to display a tooltip from (such as a button, link, etc.), add an onmouseover call to the escape function as per the wz_tooltip documentation. Here's the HTML for the example tooltip shown above: &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: maroon"&gt;li&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="COLOR: red"&gt;onmouseover&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="this.T_WIDTH=400;return escape('&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img src=\'../images/communities.jpg\'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; height=150 /&amp;gt;&amp;lt;/td&amp;gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;communities&amp;lt;/b&amp;gt; - establishing online communities with&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;services such as forums, newsgroups, blogs, &lt;/span&gt;&lt;span style="COLOR: blue"&gt;file sharing and photo galleries&amp;lt;/td&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;&lt;span style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;')"&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="MARGIN: 0px"&gt;         communities&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: maroon"&gt;li&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;That's all there is to it!&amp;nbsp;&amp;nbsp; Here's a pic of how we've used it.&lt;/p&gt;
&lt;p&gt;&lt;a href="/photos/blogpyx/picture37.aspx" target=_blank&gt;&lt;img src="/photos/blogpyx/images/37/original.aspx" border=0 /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/photos/blogpyx/picture37.aspx" target=_blank&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can also see it in action yourself at our &lt;a href="/pages/services.aspx" target=_blank&gt;Services page&lt;/a&gt;. Just hover your mouse over the &lt;strong&gt;services list&lt;/strong&gt; at the right. &lt;/p&gt;&lt;img src="http://www.clyxstudios.com/aggbug.aspx?PostID=38" width="1" height="1"&gt;</description><category domain="http://www.clyxstudios.com/blogs/development/archive/tags/Community+Server/default.aspx">Community Server</category><category domain="http://www.clyxstudios.com/blogs/development/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://www.clyxstudios.com/blogs/development/archive/tags/Javascript/default.aspx">Javascript</category></item></channel></rss>