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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search and replace

    Hi,

    I am trying to create a search and replace tool for a WYSIWYG

  • #2
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Searc and Replace

    Hi,

    I am trying to create a search and replace tool for a wysiwyg editor, but am unable to do it. So far I have the following code:

    function searchfor(){
    if (document.table.match[0].checked==true){
    var method = 2;
    }
    else{
    var method = 0;
    }
    var range = opener.editor.document.body.createTextRange();
    var result = range.findText(document.table.criteria.value, 0, method);
    if (result){
    var text = range.select();
    text.replace(document.table.criteria.value, "Benjamin Chivers");
    opener.editor.focus();
    }
    else{
    alert("Your search returned no results.");
    }
    }

    It finds the string fine, but I do not know how to replace.

    Any help on this matter would be most appreciated.

    Many Thanx,
    Ben Chivers

  • #3
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    here is a link for you

    http://www.devguru.com/Technologies/...g_replace.html

    see if that helps


  •  

    Posting Permissions

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