|
||
| Inside Technique : Extending the Browser : Annotate Extension The annotate extension is designed to let you add comments to a web-page. By combining this with the Generate Page extension in the InsideDHTML Tools pack, you can annotate and send an instance of a web-page to a friend. This extension follows the same principal of the URL sample. When the user right clicks and selects annotate, we prompt the user for a comment, and then highlight the selected text and insert the comment into the document. A marker is inserted that represents the comment. When the user clicks the marker, the annotation is alternatively displayed and hidden. The script below represents the framework for the annotate extension:
The above script represents all of the annotate extension minus the functions that
build the annotation. The buildAnnotation function takes the user's comment and a unique ID (supplied
by getID) and returns an HTML string with the user's comment and a small script for hiding and
showing the text:
To run this extension, you can copy and paste the script into an HTML file, save it, and register it using the same steps listed for the sample extension, or you can register the extension and run it from our site. You have now seen the basics for creating and scripting your extension. Next, we cover the more advanced features that allow you to control when the menu option is displayed and how to add a more complete user interface to your extension. Page 1:Extending the Browser © 1997-2000 InsideDHTML.com, LLC. All rights reserved. |