Knowledge Base > RichTextBox > Implementation Knowledge Base Home | Login
Search the Knowledge Base
 
Start Search in the Following Category

Activating inserted hyperlink in WYSIWYG.

 

You can use javascript like the following to make a link active in RTB WYSIWYG mode just like a button etc.

 

Note: Please add the sample script to the end of .aspx page containing RichTextBox – like put the script after the </form> tag but before the </body> tag

Be sure to add _x5 to the ID of RichTextBox as this refers to the RichTextBox IFrame element.

 

<script language=javascript>

          function modifySelected()

          {

            var selectedText = RichTextBox1_x5.document.selection;

            var newRange = selectedText.createRange();

            var obj = newRange.parentElement();

            if (obj.href)

            {

              window.open(obj.href, "NewWindow"); //Opens the link in new window

            }

          }

        

      RichTextBox1_x5.document.body.onclick = modifySelected;

</script>

 




Did this page answer your question? If not, try the Forums or contact us.

Copyright Richer Components 2005. All rights reserved. No part of this article may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording or otherwise) without the prior written permission of Richer Components. All brand names and product names used in this article are trade names, service marks, trademarks, or registered trademarks of their respective owners.


Knowledge Base Software - myKB.com