Dynamisch Link einfügen (IE;document.execCommand()

Hi ich habe nach diesem prima Tutorial, mir einen Mini- Online- Html- Editor gemacht:
http://www.tutorials.de/tutorials24357.html

Weis vielleicht jemand wie ich einen Link einfügen kann ?
Oder einen Verweis auf ein Bild ?

Danke
schönen Gruß Sebastian

Hi,

ich hab das folgendermaßen gelöst, vielleicht hilfts Dir etwas auf die Sprünge (Die Funktion „getSelection()“ wird bei jedem onClick()-Event meines Editor-Layers „cnt_editor“ aufgerufen.

MfG
Manuel Kirchberger
http://www.i-dreams.de

\<!--
 var txtSelection = null; 
 var htmlObject = null;
 var selectionType = "NONE";

//... ein paar uninteressante Funktionen ... :o)

function setLink(linkurl)
{
 txtSelection.execCommand('CreateLink', false, linkurl);
}

function getSelection() 
{
 selectionType = cnt\_editor.document.selection.type.toUpperCase();
 txtSelection = cnt\_editor.document.selection.createRange();

 if(selectionType=="TEXT") { 
 if(txtSelection==null) {
 txtSelection.expand("character");
 cnt\_editor.focus();
 return;
 }
 }
 else if(selectionType=="CONTROL") {
 if(txtSelection.length!=1) return;
 htmlObject = txtSelection(0);

 if(txtSelection(0).tagName=="IMG") {
 txtSelection = document.body.createTextRange();
 txtSelection.moveToElementText(htmlObject);
 txtSelection.select();
 cnt\_editor.focus();
 return;
 }
 }
}


//--\>

[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]