Hi i'm new buy of fckeditor, and sorry for my bad english....
There is someone that can explain to me how create e button that alert() the html contents of a text write in fck editor?
All i want to do is replace the save button with another button that when i click it alert() the html content.
i've open fckeditor with ajax in this way:
var fck = new FCKeditor( 'w' );
fck.BasePath = './fckeditor/';
fck.Value = 'hello word';
document.getElementById('w').innerHTML = fck.CreateHtml();
but if i do this:
<input type="button" name="b" id="b" onclick="alert(document.getElementById('w').value)">
when i click it, it show to me "<p>hello word</p>" even if i change the text inside the editor.
the form that contains the fckeditor is this:
<form action="z.php">
<div name="w" id="w" class="xy"></div>
</form>
"z.php" is simply this
<?php
echo $_POST['w'];
?>
when i click the save button it works fine so i believe tha the "save" button in some way take the new text and write it in
document.getElementById('w').value and than submit the form.
I want only take the new text and write it in document.getElementById('w').value without submit the form. There is any way?
thanks to all
There is someone that can explain to me how create e button that alert() the html contents of a text write in fck editor?
All i want to do is replace the save button with another button that when i click it alert() the html content.
i've open fckeditor with ajax in this way:
var fck = new FCKeditor( 'w' );
fck.BasePath = './fckeditor/';
fck.Value = 'hello word';
document.getElementById('w').innerHTML = fck.CreateHtml();
but if i do this:
<input type="button" name="b" id="b" onclick="alert(document.getElementById('w').value)">
when i click it, it show to me "<p>hello word</p>" even if i change the text inside the editor.
the form that contains the fckeditor is this:
<form action="z.php">
<div name="w" id="w" class="xy"></div>
</form>
"z.php" is simply this
<?php
echo $_POST['w'];
?>
when i click the save button it works fine so i believe tha the "save" button in some way take the new text and write it in
document.getElementById('w').value and than submit the form.
I want only take the new text and write it in document.getElementById('w').value without submit the form. There is any way?
thanks to all
Re: get the html contents
this is the solution: the html form must be done in this way
<form action="" method="POST" onsubmit="alert(FCKeditorAPI.GetInstance('w').GetXHTML());return false;">
<div id="w" name="w" class="xy"></div>
</form>
when i click the "save" button it alert me the content html of fckeditor without loading any page.
however thanks all
bye