A report shows all time sales quantity by product names. As this report is used online ( HTML format in Internet Explorer), business thinks it will be handy to show Product description as tooltip on the product names. When the user hovers their mouse pointer over Product name, a tooltip should appear, describing the product.
Create a simple list report with Product name, Product description, and Sales Quantity as columns.
'<span title="' + [Query1].[Product description] + '">'
</span>
Here we are using our familiar and very useful HTML tag called <span>
. We used it earlier for applying JavaScript for prompt manipulation. In this recipe, we are wrapping the product name within a span and defining its Title to be Product description.
When report is run in web browser, the title is shown as Tooltip.
Once you define the span, you can do much more to the item. For example, overriding the mouse events. Please refer to HTML guides for this.
Read about using SPAN to manipulate the prompt control in previous chapter (Chapter 3, Tips and Tricks: JavaScript—Prompt page).