Update Link

  •  01-15-2007, 8:03 AM

    Update Link

    Hi
     
    We have created our own dialog for selecting links from within our CMS system. I want to be able to select an image or link within the editor, then be able to update the link. So far the code I have just add links. I found in your forum some code to get the href, but I have been unable to update it. Can you shed some light on this and how i can update the current href. I have tried the below code but it does not seem to update the href attribute. If i set the innerHTML that works fine ie. it changes whats being linked OK but thats not the bit i wish to change.
     
    Any ideas?
     
    Thanks
    Andy
     

    var aHREF = editor1.SearchSelectionElement('A');
    if (aHREF == null)
    {
      editor1.PasteHTML('<a href ="' + URL + '"' +'target="_blank"' +'title="opens in a new window"' +'>' + getLinkHTML() + '</a>');
    }
    else
    {
      aHREF.setAttribute(
    'href', URL);
    }

View Complete Thread