Ok I am working on a WYSIWYG(what you see is what you get) rich text editor. It uses an editable Iframe. So basically it uses:
[CODE]objEditor = document.getElementById(‘message’).contentWindow.document;
objEditor.designMode = ‘on’;
and
[CODE]execCommand();
So what I’m trying to do is get hyperlinks to set correctly.
I want something that does the same thing as:
[CODE]function createURL() {
var szURL = prompt(“Enter a URL:”, “http://”);
if ((szURL != null) && (szURL != “”)) {
objEditor.execCommand(“CreateLink”,false,szURL);
}
}
Except I would like to use a CSS “popup”. Basically I just want the same thing, but have it not look ugly, which means using CSS.
I have made it so the popup with a text box and submit button will show up over top of the iframe, but I’m not sure how to get the selected iframe text to become a hyperlink when I submit the form.
This is what I have for the form:
[CODE]<span id=”hlpop”>
<form action=”Javascript:linkit();”>
Address:<br>
<input type=”text” id=”linkaddress”><br>
<input type=”submit” value=”Create Hyperlink”>
</form>
</span>
This is the action of the form:
[CODE]function linkit(){
var urlness = document.getElementById(“linkaddress”).value;
objEditor.execCommand(‘CreateLink’,’true’,urlness);
}
Any ideas? Thanks.