Hi, I am trying to create an add link button to a wysiwyg editor, anyways… What i have is a new window pops up asking for user input, the variables are then passed back from the window, then I need to make a link using the varialbes theUrl, TheTarget, and maybe theTitle.
url = theUrl + "\\" " + "target=" + "\\"" + theTarget; theIframe.contentWindow.document.execCommand("CreateLink", false, url);
This gives me a link with the hex codes for " and space.
I also tried using this but I cannot get theSelection to be the text that is selected.
theSelection = theIframe.contentWindow.getSelection(); theRange = theSelection.getRangeAt(0); theRange.collapse(false); var newLink = theIframe.contentWindow.document.createElement("a"); var someText = document.createTextNode(theSelection); newLink.target = theTarget; newLink.href = theUrl; newLink.title = theTitle; newLink.appendChild(someText); theRange.insertNode(newLink);
Thanks for any advice.