http://cksource.com/forums/viewtopic.php?f=6&t=23941
<html> <head> <title>Sample CKEditor Site</title> <script type="text/javascript" src="ckeditor/ckeditor.js"></script> <script type="text/javascript" src="js/jquery.js"> </script> <script type="text/javascript" src="js/add_link.js"></script> </head> <body> <form> My Editor:<br /> <textarea id="editor1" name="editor1" onfocus="window.lstText=this;" ></textarea> <script type="text/javascript"> CKEDITOR.replace( 'editor1' ); </script> <input type="submit" /> <br /><br /> <select id="take"> <option value="<a href='google.ro' >volvo</a">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> <input type="button" value="insert" onclick="insert(window.lstText)" /> </form> </body> </html>
function insert(el, ins) {
window.lstText={};
if (typeof(ins) == 'undefined' ) {
var ins = $("#take").val();
}
if (el.setSelectionRange){
el.value = el.value.substring(0,el.selectionStart) + ins + el.value.substring(el.selectionStart,el.selectionEnd) + el.value.substring(el.selectionEnd,el.value.length);
}
else if (document.selection && document.selection.createRange) {
el.focus();
var range = document.selection.createRange();
range.text = ins + range.text;
}
}
