This is a migrated thread and some comments may be shown as answers.

Changing forecolor for a link does not work on FF

2 Answers 114 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Lakshman
Top achievements
Rank 1
Lakshman asked on 07 Apr 2009, 12:12 AM
When a forecolor (for example, red color) is applied on a hyperlink, the forecolor changes on IE, whereas it does not on FF. I could reproduce this from your demo site as well.

This is how the HTML gets created on both the browsers. Span tag is inside the anchor tag and therefore it works.

IE:
<a href="http://www.google.com"><span style="color: #c00000;">test</span></a>

FF:
<span style="color: #ff0000;"><a href="test">http://www.google.com">test</a></span>

We would like to get this fixed for our customers and can you please give us a workaround?

Thanks, Lakshman

2 Answers, 1 is accepted

Sort by
0
Lakshman
Top achievements
Rank 1
answered on 07 Apr 2009, 12:16 AM
Sorry, I mistyped the html for FF and here is the right one:

<span style="color: #ff0000;"><a href="http://www.google.com">test</a></span>

Thanks, Lakshman
0
Rumen
Telerik team
answered on 09 Apr 2009, 07:53 AM
Hi Lakshman,

You can customize the ForeColor command using the code below:

<telerik:RadEditor ID="RadEditor1" OnClientCommandExecuting="OnClientCommandExecuting" runat="server" >
</telerik:RadEditor>
<script type="text/javascript">
function OnClientCommandExecuting(editor, args)
{
   //The command name
   var commandName = args.get_commandName();  
      
   if (commandName == "ForeColor")
   {
       //The selected value [if command is coming from a dropdown]
       var color = args.get_value();          
      
       var selectedElem = editor.getSelectedElement();
       if (selectedElem.tagName == "A")
       {
           selectedElem.style.color = color;
           args.set_cancel(true); //cancel the original command
       }
   }
}
</script>

Thus the ForeColor tool will apply an inline color style to the selected link tag.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Lakshman
Top achievements
Rank 1
Answers by
Lakshman
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or