Ho la seguente funzione per inserire in un editor di testo html un link
Ma con IE ho il problema che al link viene aggiunto il percorso locale
esempio <a href='miolink' target='_self'>
diventa
<a href='c:\\cartella\cartella\miolink' target='_self'>
COME POSSO FARE???????
Inoltre è possibile prelevare il testo HTML relativo solo al range selezionato???
se si come se fa???![]()
codice:function insertHTML(rte) { var oRTE; tag_apertura = "<a href='miolink' target='_self'>"; tag_chiusura = "</a>"; if (document.all) { oRTE = frames[rte]; var rng; var selection = oRTE.document.selection; if (selection != null) rng = selection.createRange(); testo = tag_apertura + rng.text + tag_chiusura; oRTE.focus(); rng.cutHTML; oRTE.document.selection.createRange().pasteHTML(testo); } else { oRTE = document.getElementById(rte).contentWindow; var selection = oRTE.getSelection(); rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange(); testo = tag_apertura + rng + tag_chiusura; oRTE.focus(); oRTE.document.execCommand('insertHTML', false, testo); } }

Rispondi quotando