Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question js function for Safari - OSX

    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

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't have an answer, but maybe this link will help:
    http://developer.apple.com/internet/safari/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •