Selection methods

The Selection interface supports the following methods:

BasicPaste 
Returns   No return value 
Description  Performs a simple paste of the contents of the clipboard over the selection, if this operation is valid. See also Selection.Paste
Usage 
JScript  Selection_object.BasicPaste(); 
VBScript  Selection_object.BasicPaste 
Example 
// SoftQuad Script Language JSCRIPT:
// Paste the clipboard if the current element
// is a P.
if (Selection.ElementName(0)=="P") {
  Selection.BasicPaste();
}
 

Collapse([intCollapseDirection=1])  
Returns  No return value 
Description  Collapses the selection to an insertion point, located at its start or end point, depending on the value of intCollapseDirection. Collapsing to the start point is the default. Allowed values are:
  • 0: collapse to end point
  • 1: collapse to start point
 
Usage 
JScript  Selection_object.Collapse(intCollapseDirection); 
VBScript  Selection_object.Collapse intCollapseDirection 
Example 
// SoftQuad Script Language JSCRIPT:
// move insertion point to the end of the 
// current selection
Selection.Collapse(0);  
 

ContractCell(intDirection) 
Returns   No return value 
Description 

Contracts the table cell containing the selection, from the specified intDirection. Allowed values are:

  • 0: contract from the left
  • 1: contract from the top
  • 2: contract from the right
  • 3: contract from the bottom
 
Usage 
JScript  Selection.ContractCell(intDirection); 
VBScript  Selection.ContractCell intDirection  

Copy 
Returns  No return value 
Description  Copies the selection to the clipboard. 
Usage 
JScript  Selection_object.Copy();  
VBScript  Selection_object.Copy 

Cut 
Returns  No return value 
Description  Cuts the selection, and places it in the clipboard 
Usage 
JScript  Selection_object.Cut();  
VBScript  Selection_object.Cut 

Delete 
Returns  No return value 
Description  Deletes the selection; does not change the clipboard. 
Usage 
JScript  Selection_object.Delete();  
VBScript  Selection_object.Delete 

DeleteColumn  
Returns  No return value 
Description  Deletes the table column containing the selection. 
Usage 
JScript  Selection_object.DeleteColumn();  
VBScript  Selection_object.DeleteColumn 

DeleteRow 
Returns  No return value 
Description  Deletes the table row containing the selection. 
Usage 
JScript  Selection_object.DeleteRow();  
VBScript  Selection_object.DeleteRow 

EndKey([intLocation=0], [intSelectionType=0])  
Returns  No return value 
Description 

Moves the selection as if the End key were pressed, in various key combinations. The placement of the selection depends on the arguments provided.

The allowed values for intLocation are:

  • 0: move the selection to end of the current line (default)
  • 1: move the selection to the bottom right of the document.

The allowed values for intSelectionType are:

  • 0: collapse the selection to an insertion point (default)
  • 1: extend the selection.
 
Usage 
JScript  Selection_object.EndKey([intLocation=0], [intSelectionType=0])  
VBScript  Selection_object.EndKey [intLocation=0], [intSelectionType=0]  
Example 
// SoftQuad Script Language JSCRIPT:
// same as pressing the End key.
Selection.EndKey();  
// same as pressing Ctrl+End.
Selection.EndKey(1);  
// same as pressing Shift+End.
Selection.EndKey(0, 1);  
// same as pressing Ctrl+Shift+End.
// (Selects the entire document)
Selection.EndKey(1, 1); 
 

ExtendTo(Range) 
Returns   Boolean 
Description  Extends the selection to include the specified Range, if they both have the same container. Returns a boolean indicating whether the selection was extended. 
Usage 
JScript  Selection_object.ExtendTo(Range_object); 
VBScript  Selection_object.ExtendTo(Range_object)  

GotoNext(intGotoItem) 
Returns  No return value 
Description  Collapses the selection to an insertion point and moves forward it to the next `item', as specified by intGotoItem.The allowed values are:
  • 0: moves the selection to the next element
  • 1: moves the selection to the next table cell (the current selection must be in a table)
  • 2: moves the selection to the beginning of the next word
  • 3: moves the selection to the next word end (in the current word or next word)
 
Usage 
JScript  Selection_object.GotoNext(intGotoItem)  
VBScript  Selection_object.GotoNext intGotoItem  
Example 
// SoftQuad Script Language JSCRIPT:
// move cursor to the beginning of the next word.
Selection.GotoNext(2);  
 

GotoPrevious(intGotoItem) 
Returns  No return value 
Description  The same as GotoNext, but moves backward. 

HomeKey([intLocation=0], [intSelectionType=0]) 
Returns  No return value 
Description 

Moves the selection as if the Home key were pressed, in various key combinations. The placement of the selection depends on the arguments provided.

The allowed values for intLocation are:

  • 0: move the selection to start of the current line (default)
  • 1: move the selection to the upper left of the document.

The allowed values for intSelectionType are:

  • 0: collapse the selection to an insertion point (default)
  • 1: extend the selection.
 
Usage 
JScript  Selection_object.HomeKey([intLocation=0], [intSelectionType=0])  
VBScript  Selection_object.HomeKey [intLocation=0], [intSelectionType=0]  
Example 
// SoftQuad Script Language JSCRIPT:
// same as pressing the Home key.
Selection.HomeKey();  
// same as pressing Ctrl+Home.
Selection.HomeKey(1);  
// same as pressing Shift+Home.
Selection.HomeKey(0, 1);  
// same as pressing Ctrl+Shift+Home.
Selection.HomeKey(1, 1); 
 

Indent 
Returns  No return value 
Description  Surrounds the selection with a BLOCKQUOTE element.  
Usage 
JScript  Selection_object.Indent();  
VBScript  Selection_object.Indent  

InsertBreak 
Returns  No return value 
Description  Inserts a BR element at the selection.  
Usage 
JScript  Selection_object.InsertBreak();  
VBScript  Selection_object.InsertBreak  

InsertCaption 
Returns  No return value 
Description  Inserts a table caption.  
Usage 
JScript  Selection_object.InsertCaption();  
VBScript  Selection_object.InsertCaption  

InsertColumnsLeft([longNumber=1]) 
Returns  No return value 
Description  Inserts longNumber table columns to the left of the column containing the selection. The default is one column. 
Usage 
JScript  Selection_object.InsertColumnsLeft([longNumber=1]);  
VBScript  Selection_object.InsertColumnsLeft [longNumber=1]  

InsertColumnsRight([longNumber=1]) 
Returns  No return value 
Description  Inserts longNumber table columns to the right of the column containing the selection. The default is one column. 
Usage 
JScript  Selection_object.InsertColumnsRight([longNumber]);  
VBScript  Selection_object.InsertColumnsRight [longNumber]  

InsertComment 
Returns  No return value 
Description  Inserts a comment. 
Usage 
JScript  Selection_object.InsertComment;  
VBScript  Selection_object.InsertComment 

InsertElement(strElementName) 
Returns  No return value 
Description  Inserts the element strElementName at the selection. Does not insert default content, if specified in the HoTMetaL PRO Customization editor. Leaves the selection inside the new element. See also Selection.InsertWithTemplate and Selection.InsertElementWithRequired
Usage 
JScript  Selection_object.InsertElement("strElementName");  
VBScript  Selection_object.InsertElement "strElementName" 
Example 
// SoftQuad Script Language JSCRIPT:
// inserts a <B> element at the selection.
Selection.InsertElement("B");
 

InsertElementWithRequired(strElementName)  
Returns  No return value 
Description  Inserts the element strElementName, and its first required child element (if there is one). This insertion process is recursive, so that if the required child element itself has a first required child element, it will be inserted, and so forth. Note that this does not mean that all required child elements of strElementName will be inserted, just the recursive sequence of first required child elements.  
Usage 
JScript  Selection_object.InsertElementWithRequired ("strElementName");  
VBScript  Selection_object.InsertElementWithRequired "strElementName"  
Example 
// SoftQuad Script Language JSCRIPT:
// inserts an <ADDRESS> element at 
// the document's selection.
Selection.InsertElementWithRequired("ADDRESS");
 

InsertEntity(strEntityName) 
Returns  No return value 
Description  Inserts a reference to the entity strEntityName
Usage 
JScript  Selection_object.InsertEntity("strEntityName");  
VBScript  Selection_object.InsertEntity "strEntityName"  
Example 
// SoftQuad Script Language JSCRIPT:
// inserts an &nbsp; entity reference.
Selection.InsertEntity("nbsp");  
 

InsertForm(intFormElement) 
Returns  No return value 
Description  Inserts an HTML form element at the current selection. The form element inserted is specified by intFormElement. The allowed values are:
  • 0: FORM element
  • 1: text box
  • 2: check box
  • 3: radio (option) button
  • 4: submit button
  • 5: reset button
  • 6: image submit button
  • 7: hidden input field
  • 8: file upload field
  • 9: password field
  • 10: push button
  • 11:drop-down menu
  • 12: list box
  • 13: text area
 
Usage 
JScript  Selection_object.InsertForm(intFormElement);  
VBScript  Selection_object.InsertForm intFormElement  
Example 
// SoftQuad Script Language JSCRIPT:
Selection.InsertForm(0);  // insert a <FORM> element
Selection.InsertForm(4);  // insert a submit button
 

InsertHorizontalRule 
Returns  No return value 
Description  Inserts an HR element at the current selection.  
Usage 
JScript  Selection_object.InsertHorizontalRule();  
VBScript  Selection_object.InsertHorizontalRule  

InsertImage(strSrc, [strAlt], [strAlign], [strWidth], [strHeight], [strBorder])  
Returns  No return value 
Description  Inserts the IMG element at the selection, with the specified attribute values.  
Usage 
JScript  Selection_object.InsertImage("strSrc", "strAlt", "strAlign", "strWidth", "strHeight", "strBorder");  
VBScript  Selection_object.InsertImage "strSrc", "strAlt", "strAlign", "strWidth", "strHeight", "strBorder" 
Example 
// SoftQuad Script Language JSCRIPT:
//Insert a picture "yourgif.gif" with 20x20 dimension, 
//aligned to bottom with a border
Selection.InsertImage("c:/yourgif.gif", "your picture", 
                     "bottom", "20", "20", "1");
// Insert a picture "santiago.jpg"; dimensions
// will be inserted automatically
Selection.InsertImage("santiago.jpg");
 

InsertLink(strHref, strTarget) 
Returns  No return value 
Description  Inserts an A tag at the selection, with the specified HREF and TARGET attribute values.  
Usage 
JScript  Selection_object.InsertLink("strHref", "strTarget");  
VBScript  Selection_object.InsertLink "strHref", "strTarget" 
Example 
// SoftQuad Script Language JSCRIPT:
// Insert a link to the SoftQuad site with the 
// target to a new window
Selection.InsertLink("http://www.softquad.com", "_new");
 

InsertNBSP 
Returns  No return value 
Description  Insert a non-breaking space (&nbsp; entity).  
Usage 
JScript  Selection_object.InsertNBSP();  
VBScript  Selection_object.InsertNBSP 

InsertProcessingInstruction 
Returns   No return value 
Description  Inserts a processing instruction to the right of the selection. The selection becomes an insertion point inside the processing instruction. See also Selection.InsertReplaceableText
Usage 
JScript  Selection_object.InsertProcessingInstruction(); 
VBScript  Selection_object.InsertProcessingInstruction 
Example 
// SoftQuad Script Language JSCRIPT: 
Selection.InsertProcessingInstruction();
 

InsertReplaceableText(strData) 
Returns   No return value 
Description  Inserts an xm-replace_text processing instruction (represents replaceable text in the WYSIWYG and Tags On views). The target component of the processing instruction will be the string xm-replace_text, and the data component will be strData
Usage 
JScript  Selection.InsertReplaceableText("strData"); 
VBScript  Selection.InsertReplaceableText "strData" 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.InsertReplaceableText("Section Title");
 

InsertRowsAbove([longNumber=1]) 
Returns  No return value 
Description  Insert longNumber table rows above the row containing the selection.  
Usage 
JScript  Selection_object.InsertRowsAbove([longNumber=1]);  
VBScript  Selection_object.InsertRowsAbove [longNumber=1] 

InsertRowsBelow([longNumber=1]) 
Returns  No return value 
Description  Insert longNumber table rows below the row containing the selection. 
Usage 
JScript  Selection_object.InsertRowsBelow([longNumber]);  
VBScript  Selection_object.InsertRowsBelow [longNumber] 

InsertTable(longRows, longCols, [strBGColor], [strTableWidth], [strTableWidthUnit], [strTableBorder], [intCellPadding], [intCellSpacing])  
Returns  No return value 
Description  Inserts an HTML table at the selection, with the specified parameters:
  • intRows - number of rows
  • intCols - number of columns
  • strBGColor - background color
  • strTableWidth - table width
  • strTableWidthUnit - unit of measure for table width
  • strTableBorder - border width
  • intCellPadding - cell padding, in pixels
  • intCellSpacing - cell spacing, in pixels
 
Usage 
JScript  Selection_object.InsertTable(intRows, intCols, "strBGColor", "strTableWidth", "strTableWidthUnit", "strTableBorder", intCellPadding, intCellSpacing);  
VBScript  Selection_object.InsertTable intRows, intCols, "strBGColor", "strTableWidth", "strTableWidthUnit", "strTableBorder", intCellPadding, intCellSpacing 
Example 
// SoftQuad Script Language JSCRIPT:
// Insert a 2x2 table with a white background, 
// 100% width,  a border size of 1
// cell padding of 10 pixels, and
// cell spacing of 5 pixels
Selection.InsertTable(2, 2, "#ffffff", "100", "%", "1", 10, 5);
 

InsertWithTemplate(strElementName) 
Returns   No return value 
Description  Inserts the element strElementName. If default content has been specified in the HoTMetaL PRO Customization editor, this content will be inserted with the element; if a script was specified, it will be executed. This method can be used in `default content' scripts to insert other elements and their default content. See also Selection.InsertElement and Selection.InsertElementWithRequired
Usage 
JScript  Selection_object.InsertWithTemplate("strElementName"); 
VBScript  Selection_object.InsertWithTemplate "strElementName" 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.InsertWithTemplate("P");
 

JoinElementToPreceding 
Returns  No return value 
Description  Join the element containing the selection with the element immediately preceding it, if legal. 
Usage 
JScript  Selection_object.JoinElementToPreceding();  
VBScript  Selection_object.JoinElementToPreceding 
Example 
// SoftQuad Script Language JSCRIPT:
//Take the following XML file
//<p>data1 </p>
//<p>data2 </p>
// The following script will merge the 
// <p> tags and contents 
// into one if the document selection is 
// in the second <p> tag (data2).
Selection.JoinElementToPreceding();
// The result:
//<p> data1 data2 </p>
 

ListIndent([strElementName]) 
Returns  No return value 
Description  Demotes a list item to a sublist. The sublist will have element type strElementName (if specified), otherwise the same type as the current list. 
Usage 
JScript  Selection_object.ListIndent([strElementName]);  
VBScript  Selection_object.ListIndent [strElementName] 
Example 
// SoftQuad Script Language JSCRIPT:
// Demote current list item to a
// "SimpleList" list
Selection.Indent("SimpleList");
 

ListOutdent([strElementName]) 
Returns  No return value 
Description  Promotes a list item out of its list. The list item will be promoted to a strElementName element (if specified), otherwise to the default paragraph element. 
Usage 
JScript  Selection_object.ListOutdent([strElementName]);  
VBScript  Selection_object.ListOutdent [strElementName] 
Example 
// SoftQuad Script Language JSCRIPT:
// Promote current list item to a
// "Note" element
Selection.ListOutdent("Note");
 

Layout 
Returns  Boolean 
Description  Applies text layout (as specified in the Text Layout tab of the Customization editor) to the current selection. This method can be used only if the document is displayed in HTML Source view; Layout returns true if the document is in HTML Source view, and false otherwise. See also Document.Layout
Usage 
JScript  Selection_object.Layout();  
VBScript  Selection_object.Layout 
Example 
// SoftQuad Script Language JSCRIPT:
// Format the selection
if (ActiveDocument.ViewType == 2) {
   Selection.Layout();
}
 

MergeCellDown 
Returns  No return value 
Description  Merges the table cell containing the selection with the cell below it. 
Usage 
JScript  Selection_object.MergeCellDown();  
VBScript  Selection_object.MergeCellDown 

MergeCellLeft 
Returns  No return value 
Description  Merges the table cell containing the selection with the cell to its left.  
Usage 
JScript  Selection_object.MergeCellLeft();  
VBScript  Selection_object.MergeCellLeft 

MergeCellRight 
Returns  No return value 
Description  Merges the table cell containing the selection with the cell to its right.  
Usage 
JScript  Selection_object.MergeCellRight();  
VBScript  Selection_object.MergeCellRight 

MergeCellUp 
Returns  No return value 
Description  Merges the table cell containing the selection with the cell above it. 
Usage 
JScript  Selection_object.MergeCellUp();  
VBScript  Selection_object.MergeCellUp 

MoveColumnLeft 
Returns  No return value 
Description  Moves the column containing the selection one column to the left. 
Usage 
JScript  Selection_object.MoveColumnLeft();  
VBScript  Selection_object.MoveColumnLeft 

MoveColumnRight 
Returns  No return value 
Description  Moves the column containing the selection one column to the right. 
Usage 
JScript  Selection_object.MoveColumnRight();  
VBScript  Selection_object.MoveColumnRight 

MoveDown([intSelectionType=0]) 
Returns  No return value 
Description  Moves the selection down. intSelectionType specifies the type of resulting selection:
  • 0: Collapse the selection to an insertion point, and move it to the next line, directly below the end point of the original selection (default).
  • 1: Extend the selection to the next line, ending directly below the end point of the original selection.
 
Usage 
JScript  Selection_object.MoveDown([intSelectionType]);  
VBScript  Selection_object.MoveDown [intSelectionType] 
Example 
// SoftQuad Script Language JSCRIPT:
// moves selection down
Selection.MoveDown();  
// moves selection down and highlights text.
Selection.MoveDown(1);  
 

MoveLeft([intSelectionType=0]) 
Returns  No return value 
Description  Moves the selection to the left. intSelectionType specifies the type of resulting selection:
  • 0: Collapse the selection to an insertion point, and move it one character to the left of the start point of the original selection (default).
  • 1: Move the endpoint of the selection one character to the left.
 
Usage 
JScript  Selection_object.MoveLeft([intSelectionType]);  
VBScript  Selection_object.MoveLeft [intSelectionType] 
Example 
// SoftQuad Script Language JSCRIPT:
// moves selection to left
Selection.MoveLeft(); 
// moves selection to left and highlights text.
Selection.MoveLeft(1);  
 

MoveRight([intSelectionType=0]) 
Returns  No return value 
Description  Moves the selection to the right. intSelectionType specifies the type of resulting selection:
  • 0: Collapse the selection to an insertion point, and move it one character to the right of the end point of the original selection (default).
  • 1: Extend the selection one character to the right.
 
Usage 
JScript  Selection_object.MoveRight([intSelectionType]);  
VBScript  Selection_object.MoveRight [intSelectionType] 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.MoveRight();  // moves cursor to right
// moves cursor to right and highlights text.
Selection.MoveRight(1);  
 

MoveRowDown 
Returns  No return value 
Description  Moves the table row containing the selection one row down. 
Usage 
JScript  Selection_object.MoveRowDown();  
VBScript  Selection_object.MoveRowDown  

MoveRowUp 
Returns  No return value 
Description  Moves the table row containing the selection one row up. 
Usage 
JScript  Selection_object.MoveRowUp();  
VBScript  Selection_object.MoveRowUp 

MoveToDocumentEnd 
Returns   No return value 
Description  Makes the selection an insertion point at the end of the document. 
Usage 
JScript  Selection_object.MoveToDocumentEnd(); 
VBScript  Selection_object.MoveToDocumentEnd 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.MoveToDocumentEnd();
 

MoveToDocumentStart 
Returns   No return value 
Description  Makes the selection an insertion point at the start of the document. 
Usage 
JScript  Selection_object.MoveToDocumentStart(); 
VBScript  Selection_object.MoveToDocumentStart 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.MoveToDocumentStart();
 

MoveToElement([strElementName],[boolForward=true]) 
Returns   Boolean 
Description  Moves the selection to the specified strElementName. By default, the movement is forward; if boolForward is false, the movement is backward. If strElementName is omitted or empty, the selection moves to the next element of any type. MoveToElement does not wrap around the top or bottom of the document; that is, it stops if it reaches the top or bottom. 
Usage 
JScript  Selection_object.MoveToElement(["strElementName"], [intDirection]); 
VBScript  Selection_object.MoveToElement(["strElementName"], [intDirection])  
Example 
// SoftQuad Script Language JSCRIPT:
var rng=ActiveDocument.Range;
rng.MoveToElement("P",false);
// make the range visible
rng.Select();
 

MoveUp([intSelectionType=0]) 
Returns  No return value 
Description  Moves the selection up. intSelectionType specifies the type of resulting selection:
  • 0: Collapse the selection to an insertion point, and move it to the previous line, directly above the start point of the original selection (default).
  • 1: Extend the selection to the previous line, ending directly above the start point of the original selection.
 
Usage 
JScript  Selection_object.MoveUp([intSelectionType]);  
VBScript  Selection_object.MoveUp [intSelectionType] 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.MoveUp();  // moves selection up
// moves selection up and highlights text.
Selection.MoveUp(1);  
 

Outdent 
Returns  No return value 
Description  If the selection's container is contained in a BLOCKQUOTE element, the BLOCKQUOTE will be removed.  
Usage 
JScript  Selection_object.Outdent();  
VBScript  Selection_object.Outdent  

PageDown 
Returns  No return value 
Description  Scrolls the document one page down. 
Usage 
JScript  Selection_object.PageDown();  
VBScript  Selection_object.PageDown  

PageUp 
Returns  No return value 
Description  Scrolls the document one page up. 
Usage 
JScript  Selection_object.PageUp();  
VBScript  Selection_object.PageUp  

Paste 
Returns  No return value 
Description  Pastes the contents of the clipboard over the selection using a `smart paste' operation that will attempt to split elements or make other modifications so that the paste will occur at a valid location. See also Selection.BasicPaste
Usage 
JScript  Selection_object.Paste();  
VBScript  Selection_object.Paste  

PasteString(strText) 
Returns  No return value 
Description  Pastes the text specified by strText over the selection. See also Selection.CanPaste
Usage 
JScript  Selection_object.PasteString("strText");  
VBScript  Selection_object.PasteString "strText" 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.PasteString("hello");
 

PasteStringWithInterpret(String) 
Returns   No return value 
Description  Replaces the selection with the content in String. If String is tab-formatted as a list or table, it will be interpreted as such when pasted. See also Selection.CanPaste
Usage 
JScript  Selection_object.PasteStringWithInterpret("String"); 
VBScript  Selection_object.PasteStringWithInterpret "String" 
Example 
// SoftQuad Script Language JSCRIPT:
var tableString;
tableString=Application.FileToString("c:\\table1.txt");
if (Selection.CanPaste(tableString,true)) {
   Selection.PasteStringWithInterpret(tableString);
}
else {
   
   Selection.InsertElement("PRE");
   Selection.PasteString(tableString);
}
 

RemoveContainerTags 
Returns   No return value 
Description  Removes the tags of the selection's container. (In effect, this removes the container.) 
Usage 
JScript  Selection.RemoveContainerTags(); 
VBScript  Selection.RemoveContainerTags 
Example 
// SoftQuad Script Language JSCRIPT:
if (Selection.ContainerName == "EM")
   Selection.RemoveContainerTags();
 

SelectAfterContainer 
Returns  No return value 
Description  Collapses the selection to an insertion point, and moves it directly after the element that contained the original selection. 
Usage 
JScript  Selection_object.SelectAfterContainer();  
VBScript  Selection_object.SelectAfterContainer 

SelectAfterNode(DOMNode) 
Returns  No return value 
Description  Collapses the selection to an insertion point, and moves it directly after the container corresponding to the specified DOMNode
Usage 
JScript  Selection_object.SelectAfterNode(Node);  
VBScript  Selection_object.SelectAfterNode Node 
Example 
// SoftQuad Script Language JSCRIPT:
//Moves the cursor to after the container's node.
Selection.SelectAfterNode(Selection.ContainerNode);
 

SelectAll 
Returns   No return value 
Description  Selects the entire contents of the document that contains the selection. 
Usage 
JScript  Selection_object.SelectAll(); 
VBScript  Selection_object.SelectAll 

SelectBeforeContainer 
Returns  No return value 
Description  Collapses the selection to an insertion point, and moves it directly before the original selection's container. 
Usage 
JScript  Selection_object.SelectBeforeContainer();  
VBScript  Selection_object.SelectBeforeContainer 

SelectBeforeNode(DOMNode) 
Returns  No return value 
Description  Collapses the selection to an insertion point, and moves it directly before the container corresponding to the specified DOMNode
Usage 
JScript  Selection_object.SelectBeforeNode(Node);  
VBScript  Selection_object.SelectBeforeNode Node 
Example 
// SoftQuad Script Language JSCRIPT:
// Moves the selection to before the selection's
// container  node.
Selection.SelectBeforeNode(Selection.ContainerNode);
 

SelectContainerContents 
Returns  No return value 
Description  Selects the entire contents of the selection's container. See also Selection.SelectElement
Usage 
JScript  Selection_object.SelectContainerContents();  
VBScript  Selection_object.SelectcontainerContents 

SelectElement 
Returns  No return value 
Description  Selects the entire container (element, comment, or processing instruction, including tags) containing the selection.  
Usage 
JScript  Selection_object.SelectElement();  
VBScript  Selection_object.SelectElement 

SelectNodeContents(DOMNode) 
Returns  No return value 
Description  Selects all the contents of the node specified by DOMNode
Usage 
JScript  Selection_object.SelectNodeContents(DOMNode);  
VBScript  Selection_object.SelectNodeContents DOMNode 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.SelectNodeContents(Selection.ContainerNode);
 

SplitCellColumn 
Returns  No return value 
Description  Splits the table cell containing the selection into two columns. The original contents will remain in the cell on the left. 
Usage 
JScript  Selection_object.SplitCellColumn();  
VBScript  Selection_object.SplitCellColumn 

SplitCellRow 
Returns  No return value 
Description  Splits the table cell that contains the selection into two rows. The original contents will remain in the top row. 
Usage 
JScript  Selection_object.SplitCellRow();  
VBScript  Selection_object.SplitCellRow 

SplitContainer 
Returns  No return value 
Description  Splits the selection's container into two containers of the same type as the original container, at the start point of the selection. The selection remains in the second part. This method performs the same action as the HoTMetaL PRO Split Element command. 
Usage 
JScript  Selection_object.SplitContainer();  
VBScript  Selection_object.SplitContainer 

Surround(strElementName) 
Returns  No return value 
Description  Surrounds the selection with the strElementName element. 
Usage 
JScript  Selection_object.Surround("strElementName");  
VBScript  Selection_object.Surround "strElementName" 
Example 
// SoftQuad Script Language JSCRIPT:
//surrounds the selected text with <P> tags
Selection.Surround("P");  
 

ToggleTableCellType 
Returns  No return value 
Description  Toggles the table cell containing the selection between the TD element and the TH element.  
Usage 
JScript  Selection_object.ToggleTableCellType();  
VBScript  Selection_object.ToggleTableCellType 

TypeText(strText) 
Returns  No return value 
Description  Pastes strText over the selection. 
Usage 
JScript  Selection_object.TypeText("strText");  
VBScript  Selection_object.TypeText "strText" 
Example 
// SoftQuad Script Language JSCRIPT:
Selection.TypeText("Insert text here!");
 

TypingSplit 
Returns  No return value 
Description  This method has the same effect as pressing the Enter key. This could split selection's container element, insert the container's `followed by' element, or create a line break, depending on the container. If the container is split, the selected text is moved to the new (second) container. 
Usage 
JScript  Selection_object.TypingSplit();  
VBScript  Selection_object.TypingSplit 
Example 
// SoftQuad Script Language JSCRIPT:
// Take the following file and the 
// selection covering "ata1"
// <p>data1 </p>
// The following script will split the 
// <p> tag and move "ata1"
// into the new <p> tag
Selection.TypingSplit();
// The result:
//<p>d</p>
//<p>ata1 </p>
 

Validate  
Returns  No return value 
Description  Validates the selection. A message will be displayed to the user. See also Selection.IsValid, Document.Validate and Document.IsValid 
Usage 
JScript  Selection_object.Validate();  
VBScript  Selection_object.Validate  


Right arrow
Next Topic
Left arrow
Previous Topic
Table of contents
Table of Contents

Copyright © SoftQuad Software Inc. 1999