carlsberg
02-17-2005, 09:43 AM
Hi
I've been developing an admin for a site with a function to select some text for formatting - for a client who was using PCs - so the IE-specific function was not a problem.
I had explained to them that it would not be usable on FireFox, Netscape etc and that didn't seem to worry them - but they forgot to tell me that they'd just ordered a load of Mac Minis !!
So .... now the function doesn't work and i need to include an alternative function for users of Safari on OSX.
the function that works in IE 6 is this :
function format(f) {
var str = document.selection.createRange().text;
document.form1.texte.focus();
var sel = document.selection.createRange();
sel.text = '<span class=' + f + '>' + str + '</span>';
return;
}
I read somewhere that it's the "document.selection.createRange().text" part that doesn't work on Mac and that I need to use
window.getSelection()
instead - is it just as simple as that ??
can you help me please - or point me to a site where they discuss this as i haven't found one
thanks :)
I've been developing an admin for a site with a function to select some text for formatting - for a client who was using PCs - so the IE-specific function was not a problem.
I had explained to them that it would not be usable on FireFox, Netscape etc and that didn't seem to worry them - but they forgot to tell me that they'd just ordered a load of Mac Minis !!
So .... now the function doesn't work and i need to include an alternative function for users of Safari on OSX.
the function that works in IE 6 is this :
function format(f) {
var str = document.selection.createRange().text;
document.form1.texte.focus();
var sel = document.selection.createRange();
sel.text = '<span class=' + f + '>' + str + '</span>';
return;
}
I read somewhere that it's the "document.selection.createRange().text" part that doesn't work on Mac and that I need to use
window.getSelection()
instead - is it just as simple as that ??
can you help me please - or point me to a site where they discuss this as i haven't found one
thanks :)