Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-21-2004, 12:32 AM   PM User | #1
fci
Senior Coder

 
Join Date: Aug 2004
Location: Twin Cities
Posts: 1,345
Thanks: 0
Thanked 0 Times in 0 Posts
fci is an unknown quantity at this point
find out the node/element that the cursor is in

so I am using the Rich Text Editor located here:
http://www.mozilla.org/editor/midasdemo/
and here
http://www.kevinroth.com/rte/demo.htm

anyway, I am building 'improved' table functionality.. right now I'm stuck on how I can retreive the node the cursor is a child of.
I am able to insert a table with both IE and Mozilla and I am able to modify the attribute of a TD elment in this fashion with IE:
Code:
	oRTE = frames[rte]
        oRTE.document.body.focus()
	var selection = oRTE.document.selection; 
        rng = selection.createRange()
        rng.parentElement().setAttribute('vAlign','top')
so then I am able to modify the attributes of a TD in any manner that I choose-- it'll probably end up being a layer/popup for a user to edit the 'desired' attributes.

But, I have been struggling trying to find a solution that would work with Mozilla. I wish it was as simple as 'getSelectedElement' .. and I try the getRangeAt() function with 0 as the argument and that claims to not be defined but it seems to work elsewhere in the script(it is not a typo, I'm not dyslexic and it still says it's undefined).

If I need to upload sample code for you to see what I'm doing better, let me know.
fci is offline   Reply With Quote
Old 08-21-2004, 04:33 AM   PM User | #2
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
Hi and Welcome to Coding Forums...

I recieved your P/M and I believe your problem is that Mozilla will consider whitespace as a textnode so if you are trying to walk up the tree one node, you may find yourself in an empty textnode...

And although I graciously accept your compliment, JKD knows more about this than I do and provided a good explanation of empty textnodes here....

Also, at one time, Alex Vincent posted a Mozilla whitespace removing code and the link may be found in the above link.... If not, try searching on Alex's username in the Post A Javascript forum...

.....Willy
Willy Duitt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:38 PM.


Advertisement
Log in to turn off these ads.