Thanks for the reply but I already tried that. After I studied the mozilla wysiwyg example I relised that I needed to select a range object and use that as the reference to getting something called startOffset which returned the correct value. This seems to work until I make the text within the iframe formatted (for example bold)
Code:
var selectedTexty = document.getElementById('iView').contentWindow;
alert(selectedTexty);
alert(selectedTexty.getSelection());
var sel = selectedTexty.getSelection();
alert(selectedTexty.setSelectionRange);
var range = sel.getRangeAt(0);
sel.removeAllRanges();
var startPos = range.startOffset
alert(startPos);
Any ideas why the formatting would knock out the offset value?
Cheers
Dal
Edit: Actually upon further investigation it seems that it depends where the selection is and the offset comes from the inner tag if selected ie;
offset values: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
text: "this is normal text this is bold text"
I'm sure I'll figure it but it would be handy to have as much information about these details as possible as I've never used these objects before. Scanned the web looking for handy reference but they all seem to have some things that work and somethings that dont then there are the three schools (ff,ie,safari) which handle these all differently (which doesnt help the learning cycle at all!)
Cheers again
Dal
Bookmarks