|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Nov 2000
Messaggi: 279
|
Scriviamoci sopra con ASP.NET??
Allora ragazzi io sto facendo un editor HTML in ASP.NET e per modificare lo scritto vorrei utilizzare un DIV con contenuto modificabile (visto che nè le TextArea nè altro visualizza le immagini o caratteri formattati).
Ora, il problema è questo: Come cavolo faccio a prendere il valore del DIV modificato(gradirei una soluzione in ASP.NET e una in JAva se v ne fossero)?? Es: <div id="testo2" contentEditable="true" >Ciao,ciao<img src="test.gif"></div> Vi ringrzio per l'aiuto! Ah scusate! Ma qualcuno di voi sa perchè nessuno ha mai pensato di fare una textarea con caratteri formattati e immagini?? |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Non credo che si possa poi modificare così tanto la textarea... Certo il font lo puoi cambiare, ma le immagini non ce le puoi inserire...
|
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Sep 2000
Messaggi: 886
|
Intendi qualche cosa del genere?
<%@ Page Language="C#" Debug = "true"%> <script runat = "server"> void cambia(Object sender, EventArgs e) { test.InnerText = "Ehilà"; } </script> <html> <head> <title>testdiv</title> </head> <body> <form runat = server> <div id = "test" runat = "server">ciao</div><br> <asp:Button id="Button1" runat="server" Text="Inserisci" Onclick = "cambia"></asp:Button> </form> </body></html> Fammi sapere....
__________________
1986/2008 - 22 anni di rabbia cancellati in un giorno. Adesso passeranno altri 22 anni.. ![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Nov 2000
Messaggi: 279
|
ce l'ho fatta
Ce l'ho fatta ma è stranissimo che questo attributo "contenteditable" non sia documentato (l'ho visto su un sito americano)
Grazie!! Sono gradite maggiori informazioni su questo contenteditable e già che ci siete anche su questo "execCommands". Stranissimo ma stupendo!! <%@ Page Language="VB" Debug="true" smartnavigation="True" %> <script runat="server"> Sub Page_Load(Sender As Object, E As EventArgs) If page.ispostback then else testo2.innerhtml="<img src=""ciao.gif""><img src=""test.gif"">ciao,ciao" End If DataBind() End Sub </script> <html> <head> <script language="jscript"> isHTMLMode = 0; function Esegui(cmd,opt) { if (isHTMLMode){alert("DeSeleziona visualizzazione HTML");return ;} testo2.focus() switch (cmd) { case "InsertImage": testo2.focus() testo2.document.execCommand(cmd,true,opt); break; default: testo2.focus() testo2.document.execCommand(cmd,false,opt); break; } } function save() { self.location="editor.aspx?testo=" + document.all.testo2.innerHTML } </script> </head> <body> <div width="100%" height="100%" style="border: solid" id="testo2" contenteditable="true" runat="server"> </div> <form runat="server"> <input onclick="save()" type="button" value="SALVA JAVA" /> <input type="button" id="Immagine" onclick="Esegui('InsertImage')" value="immagine"/> </form> </body> </html> |
![]() |
![]() |
![]() |
#5 |
Senior Member
Iscritto dal: Feb 2001
Città: Nordest
Messaggi: 217
|
Sia CONTENTEDITABLE che execCommand sono documentati in MSDN. Per CONTENTEDITABLE ci sono addirittura un paio di esempi d'uso, uno con i tag HTML, l'altro in JScript. Se fai una ricerca in msdn.microsoft.com dovresti trovare tutto, altrimenti ti mando le due paginette del DVD di MSDN.
|
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 16:36.