You are not logged in.
Hi,
A few things I would like to achieve but don't know which method to use;
(1) To be able replace the entire contents within a specified DIV;
<div id="content">
To dynamically replace anything within this div with another chunk of contents.
</div>
In the same fashion of insertHTML, where codes could be inserted from the cursor position in wysiwyg mode, but in this case, the cursor position is not important. We just need to replace *all* contents within the specified DIV based on its id.
(2) Is there a method to clear *all html* in the xinha editor?
(3) Like insertHTML method where cursor position is used, but what I need now is to insert HTML codes *appending* after the position of the last item in a specified DIV.
Would appreciate any advise on these areas... many thanks in advance...
Regards,
Samuel
Offline
For #1 and #3,
These appear to be some decent custom functions. Not too difficult to do in JavaScript. However, I don't believe they already exist. Why not write add them to your local copy?
For #2: Why not just use CTRL-A + DELETE?
Offline
Practicality... many thanks for your writing;
We tried for a while trying some of the xinha methods using javascript, but to no avail. For example, methods like insertHTML is rather straight forward and works well. But other methods like selectNodecontents simply would not work. I wonder if there are issues with the syntax in the way we use these methods, especially those that are used to do text manipulation within xinha.
I think what we need is to select that chunk of text first, and then use the insertHTML method to replace them with our own contents. Could anyone post a workable piece of code that could work? Really appreciate it. Thanks again...
Offline
I don't exactly understand what you are trying to do with the interface, but there are some functions for finding a cursor location in a textarea.
Here is a function to set the selection range (Not my code though):
function setSelRange(inputEl, selStart, selEnd) {
if (inputEl.setSelectionRange) {
inputEl.focus();
inputEl.setSelectionRange(selStart, selEnd);
} else if (inputEl.createTextRange) {
var range = inputEl.createTextRange();
range.collapse(true);
range.moveEnd('character', selEnd);
range.moveStart('character', selStart);
range.select();
}
}
Or you could try looking into this:
http://alexking.org/blog/2003/06/02/ins … avascript/
That should at least get you started in the right direction.
Last edited by Practicality (2007-12-20 18:10:27)
Offline