This does not work for some reason, it seems as soon as the ReplaceTextArea() is called the first instance is erased.
For example with this code, the first editor is not shown while the second one is.
Can anyone help?:
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( "Article" ) ;
oFCKeditor.Width = "700";
oFCKeditor.Height = "700";
oFCKeditor.BasePath = "/ui/functions/FCKeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
<textarea id="Article" name="Article"></textarea>
</td>
</tr>
<tr>
<td>
<h4>Comments:</h4>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( "Comments" ) ;
oFCKeditor.Width = "700";
oFCKeditor.Height = "200";
oFCKeditor.BasePath = "/ui/functions/FCKeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
<textarea id="Comments" name="Comments"></textarea>
For example with this code, the first editor is not shown while the second one is.
Can anyone help?:
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( "Article" ) ;
oFCKeditor.Width = "700";
oFCKeditor.Height = "700";
oFCKeditor.BasePath = "/ui/functions/FCKeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
<textarea id="Article" name="Article"></textarea>
</td>
</tr>
<tr>
<td>
<h4>Comments:</h4>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( "Comments" ) ;
oFCKeditor.Width = "700";
oFCKeditor.Height = "200";
oFCKeditor.BasePath = "/ui/functions/FCKeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
<textarea id="Comments" name="Comments"></textarea>
RE: Multiple instances using replacetextarea
You're assigning twice a function (a different one each time) to an event, so only the last one will be called.
RE: Multiple instances using replacetextarea
RE: Multiple instances using replacetextarea
Here is the solution (not make sure you create the textarea before calling the Javascript):
<textarea id="Article" name="Article"></textarea>
<script type="text/javascript">
var oFCKeditorArticle = new FCKeditor( "Article" ) ;
oFCKeditorArticle.Width = "700";
oFCKeditorArticle.Height = "700";
oFCKeditorArticle.BasePath = "/ui/functions/FCKeditor/" ;
oFCKeditorArticle.ReplaceTextarea();
</script>
</td>
</tr>
<tr>
<td>
<h4>Comments:</h4>
<textarea id="Comments" name="Comments"></textarea>
<script type="text/javascript">
var oFCKeditorComments = new FCKeditor( "Comments" ) ;
oFCKeditorComments.Width = "700";
oFCKeditorComments.Height = "200";
oFCKeditorComments.BasePath = "/ui/functions/FCKeditor/" ;
oFCKeditorComments.ReplaceTextarea();
</script>