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 Coder
    Join Date
    Jan 2006
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Netscape Plz help!I dont understand these methods

    hi, I'm a new comer for DOM scripting, I have a piece of code :

    function insert_text(text, movestart, moveend)
    {
    if (document.getElementById)
    {
    var editbox=document.getElementById('textbox');
    }
    else if (document.all)
    {
    var editbox= document.all['textbox'];
    }
    editbox.focus();
    if (typeof(editbox.selectionStart) != 'undefined')
    {
    var opn = editbox.selectionStart + 0;
    editbox.value = editbox.value.substr(0, editbox.selectionStart) + text + editbox.value.substr(editbox.selectionEnd);
    if (movestart === false)
    {// do nothing }
    else if (typeof movestart != 'undefined')
    {
    editbox.selectionStart = opn + movestart;
    editbox.selectionEnd = opn + text.vBlength() - moveend;
    }
    else
    {
    editbox.selectionStart = opn;
    editbox.selectionEnd = opn + text.vBlength();
    }
    }
    else if (document.selection && document.selection.createRange)
    {
    var sel = document.selection.createRange();
    sel.text = text.replace(/\r?\n/g, '\r\n');
    if (movestart === false)
    {
    // do nothing
    }
    else if (typeof movestart != 'undefined')
    {
    sel.moveStart('character', -text.vBlength() +movestart);
    sel.moveEnd('character', -moveend);
    }
    else
    {
    sel.moveStart('character', -text.vBlength());
    }
    sel.select();
    }
    else
    {
    // failed - just stuff it at the end of the message
    editbox.value += text;
    }
    }

    But I dont have any reference for selection, moveStart,MoveEnd, selectionStart and selectionEnd methos or property.I have search in all DOM level2 document.Plz help!

  • #2
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #3
    New Coder
    Join Date
    Jan 2006
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank very much, I still havent found it.Dont know how to understand that code


  •  

    Posting Permissions

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