Cześć,
Piszę formularz, w pewnym momencie ma się pojawić textarea i dobrze by było, by miała wygląd jak należy.
Program w uproszczeniu składa się z dwóch plików
wyswigStart.php i wyswig.php
WyswigStat.php wygląda następująco
<http://december.com/html/4/element/html.html> <http://december.com/html/4/element/head.html> <http://december.com/html/4/element/meta.html HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-2"> <http://december.com/html/4/element/script.html src="http://code.jquery.com/jquery-2.1.1.min.js"></http://december.com/html/4/element/script.html> <http://december.com/html/4/element/script.html src="nicEdit/nicEdit.js"></http://december.com/html/4/element/script.html> <http://december.com/html/4/element/script.html type="text/javascript">bkLib.onDomLoaded(nicEditors.allTextAreas);</http://december.com/html/4/element/script.html> <http://december.com/html/4/element/script.html type="text/javascript"> function dodawarka(){ $.get( "wyswig.php", {dane:$("#dane").val() } ).done(function( data ) { $("#wyniki").html(data); }); } </http://december.com/html/4/element/script.html> </http://december.com/html/4/element/head.html> <http://december.com/html/4/element/body.html> <http://december.com/html/4/element/button.html class='button buttonPanel' onclick='dodawarka()'>Dodaj ofertę</http://december.com/html/4/element/button.html> <http://december.com/html/4/element/div.html id='wyniki'></http://december.com/html/4/element/div.html> opis: <http://december.com/html/4/element/textarea.html width="300px"></http://december.com/html/4/element/textarea.html> </http://december.com/html/4/element/body.html> </http://december.com/html/4/element/html.html>
opis: <http://december.com/html/4/element/textarea.html width="300px"></http://december.com/html/4/element/textarea.html>
Może zamiast przestarzałego nicEdit zastosuj np. CKEditor?
Zmiana edytora niczego nie zmienia.
Z CKEdirtor:
<http://december.com/html/4/element/html.html> <http://december.com/html/4/element/head.html> <http://december.com/html/4/element/meta.html HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-2"> <http://december.com/html/4/element/script.html src="http://code.jquery.com/jquery-2.1.1.min.js"></http://december.com/html/4/element/script.html> <http://december.com/html/4/element/script.html type="text/javascript"> function dodawarka(){ $.get( "wyswig.php", {dane:$("#dane").val() } ).done(function( data ) { $("#wyniki").html(data); }); } </http://december.com/html/4/element/script.html> </http://december.com/html/4/element/head.html> <http://december.com/html/4/element/body.html> <http://december.com/html/4/element/button.html class='button buttonPanel' onclick='dodawarka()'>Dodaj ofertę</http://december.com/html/4/element/button.html> <http://december.com/html/4/element/div.html id='wyniki'></http://december.com/html/4/element/div.html> </http://december.com/html/4/element/body.html> </http://december.com/html/4/element/html.html>
<!DOCTYPE html> <http://december.com/html/4/element/html.html> <http://december.com/html/4/element/head.html> <http://december.com/html/4/element/meta.html charset="utf-8"> <http://december.com/html/4/element/title.html>CKEditor</http://december.com/html/4/element/title.html> <http://december.com/html/4/element/script.html src="https://cdn.ckeditor.com/4.11.4/standard/ckeditor.js"></http://december.com/html/4/element/script.html> </http://december.com/html/4/element/head.html> <http://december.com/html/4/element/body.html> <http://december.com/html/4/element/textarea.html name="editor1"></http://december.com/html/4/element/textarea.html> <http://december.com/html/4/element/script.html> CKEDITOR.replace( 'editor1' ); </http://december.com/html/4/element/script.html> </http://december.com/html/4/element/body.html> </http://december.com/html/4/element/html.html>
Albo nie rozumiem co chcesz zrobić, albo dobrze rozumiem, ale to co robisz jest kompletnie bezsensowne.
Po to aby dołączyć nowy edytor wczytujesz kawałek kodu HTML Ajax'em? To jak układanka domino z 250 tys. klocków po to aby włączyć światło.
Jeszcze w pierwszym przykładzie można na to przymknąć oko, ale w drugim chcesz wstawić element <html> wraz z DOCTYPE do <div>?
Na wciśnięcie przycisku powinieneś dokleić kod <textarea> do <div>, ale bez użycia Ajax.
A potem:
CKEDITOR.replace( 'id_lub_nazwa_dodanego_textarea');
Do plliku wyswig.html skopiowałem przykład z instrukcji w ten sposób plik wyswig sam działał ale jak jest wywoływany ajacem to już nie.
Przyznaję CI 100% rację, że pisanie 14 linijek kodu tam gdzie można jedną jest bez sensu.
Dzięki za rady.
Zadziałało:)
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)