Author: I Foshan Source: 5D Multimedia
In the
Function getActiveText () {obj.currpos = document.selection.createRANGE (). duplicate () // Object Customized Properties Copy of the TextRange object established in the document} Function AddText (STR) {IF Obj.currpos // If the object OBJ exists, the property currposobj.currpos.text = STR // Sets the object OBJ Currently activated the text of the TEXTRANGE object established by the Select area is the value of the parameter STR // Implement the value of the parameter STR in the cursor position Or use the value of the parameter STR to replace the medium text Else Obj.Value = STR // If the object OBJ custom attribute Currpos does not exist / / directly add the value of the parameter STR to the value of the object OBJ} script> < Textarea ID = "Obj" οnfοcus = "getActiveText ()" οnchange = "getActiveText ()"> textarea>