Come posso selezionare una img e metterci un link?
con semplice testo ci riesco
function crea_link() {
var form = document.getElementById("idForm");
sezione_attuale = form.sezione.value;
if (sezione_attuale == "") {
alert("Selezionare una sezione editabile");
form.sezione_sel.focus()
return;
}
else {
var cursore = idContent.document.selection.createRange();
var testo = cursore.htmlText;
var pos = testo.indexOf("<A");
var pos1 = 0;
if (pos > -1) {
pos1 = testo.indexOf(">");
testo = testo.substring(0,pos) + testo.substring(pos1);
}
if (pos > -1) {
testo = testo.substring(pos+1);
pos = testo.indexOf("</A>");
if (pos > -1) testo = testo.substring(0,pos);
}
else {
//******
pos = testo.indexOf(">");
if (pos > 0) testo = testo.substring(pos+1); // eliminazione dei tag
var pos = testo.indexOf("<");
if (pos > 0) testo = testo.substring(0,pos);
//********
}
if (rtsuggerimento != "") rtsuggerimento = ' title="' + rtsuggerimento + '" ';
rturl_popup = "<a href=\""+rturl_popup + " \""+ rtsuggerimento + rttarget + ">"+ testo +"</a>";
cursore.pasteHTML(rturl_popup);
//cursore.htmlText = rturl_popup;
}
}
con una img devi imappazzire con il mouse io voorei fare una cosa come fronpage
tnks a tutti