Search completed in 1.22 seconds.
Document.createRange() - Web APIs
The Document.
createRange() method returns a new Range object. Syntax range = document.
createRange(); range is the created Range object. Example let range = document.
createRange(); range.setStart(startNode, startOffset); range.setEnd(endNode, endOffset); Notes Once a Range is created, you need to set its boundary points before you can make use of most of its methods. Specifications Specification Status Comment DOMThe definition of 'document.
createRange' in that specification. Living Standard ...
AbstractRange - Web APIs
ex Range interface. Contents of elements When trying to access the contents of an element, keep in mind that the element itself is a node, but so is any text inside it. In order to set a range endpoint within the text of an element, be sure to find the text node inside the element: let startElem = document.querySelector("p"); let endElem = startElem.querySelector("span"); let range = document.
createRange(); range.setStart(startElem, 0); range.setEnd(endElem, endElem.childNodes[0].length/2); let contents = range.cloneContents(); document.body.appendChild(contents); This example creates a new range, rng, and sets its starting point to the third child node of the first element whose class is elementclass. The end point is set to be the middle of the first child of the span, and then the range is...
...t gets shown onscreen. Each element's contents are linked below it in the tree, potentially spawning a series of branches below as elements include other elements and text nodes. If you want to create a range that incorporates the contents of the <p> element whose contents are "A <em>very</em> interesting thing happened on the way to the forum...", you can do so like this: let pRange = document.
createRange(); pRange.selectNodeContents(document.querySelector("#entry1 p")); Since we wish to select the entire contents of the <p> element, including its descendants, this works perfectly. If we wish to instead copy the text "An interesting thing..." from the <section>'s heading (an <h2> element) through the end of the letters "ve" in the <em> within the paragraph below it, the following code would wor...
...Contents(document.querySelector("#entry1 p")); Since we wish to select the entire contents of the <p> element, including its descendants, this works perfectly. If we wish to instead copy the text "An interesting thing..." from the <section>'s heading (an <h2> element) through the end of the letters "ve" in the <em> within the paragraph below it, the following code would work: let r = document.
createRange(); let startNode = document.querySelector("section h2").childNodes[0]; r.setStart(startNode, 11); let endNode = document.querySelector("#entry1 p em").childNodes[0]; r.setEnd(endNode, 2); let fragment = r.cloneContents(); Here an interesting problem arises--we are capturing content from multiple nodes located at different levels of the DOM hierarchy, and then only part of one of them. What sh...
...And 2 more matches
TextRange - Web APIs
bject represents a fragment of text in a document, similar to the standard defined Range interface. This object is used to represent a specific piece of text in the document. For example, when you hold down the mouse to select the content on the page, you create a typical TextRange. It is implemented in IE, then a TextRange object can be created by Element.createTextRange() or Document.selection.
createRange(). Note that this interface is not supported in non IE browsers. Alternative Selection and Range interfaces can be used. Properties TextRange.boundingHeightRead only Returns the height of the rectangle bound to the TextRange object. TextRange.boundingLeftRead only Returns the distance between the left edge of the rectangle that binds the TextRange object and the left edge that compl...
...current range (i.e. the blue selection seen by the user). TextRange.setEndPoint() Sets the end point of the current range based on the bounds of other TextRange. Example The following example is valid under IE9. The example gets the TextRange through document.selection, and sets the specified element to be selected. IE9 supports the standard alternative Range. var range = document.selection.
createRange(); var element = document.getElementById("test"); range.moveToElementText(element); range.select(); // Selected "SomeTextToBeSelected" <!DOCTYPE html> <html> <head> <title>TextRange Example</title> </head> <body> <p id="test">SomeTextToBeSelected</p> </body> </html> Notes Use TextRange to Operate the Selection Valid only under IE9. The selection interface should be used first, if the bro...
...elected "SomeTextToBeSelected" <!DOCTYPE html> <html> <head> <title>TextRange Example</title> </head> <body> <p id="test">SomeTextToBeSelected</p> </body> </html> Notes Use TextRange to Operate the Selection Valid only under IE9. The selection interface should be used first, if the browser allows it. document.selection property returns a non-standard selection object, and the selection.
createRange() method creates a TextRange object consistent with the currently selection. var sel = document.selection; var range = sel.
createRange(); alert(range.text); // Output plaintext of the selection Note that the
createRange method does not create a reference. If you want to select the modified range after modifying the selection, you need to call the TextRange.select method. selection Compatibilit...
Range.compareNode() - Web APIs
completely selected by the Range. Warning: This method has been removed from Gecko 1.9 (Firefox 3) and will not exist in future versions of Firefox, which was the only browser implementing it; you should switch to Range.compareBoundaryPoints() as soon as possible. ...
... Specifications This method is not standard and therefore not part of any specification. ...
Range.selectNodeContents() - Web APIs
tain the contents of a Node. The parent Node of the start and end of the Range will be the reference node. The startOffset is 0, and the endOffset is the number of child Nodes or number of characters contained in the reference node. Syntax range.selectNodeContents(referenceNode); Parameters referenceNode The Node whose contents will be selected within a Range. Example range = document.
createRange(); referenceNode = document.getElementsByTagName("div")[0]; range.selectNodeContents(referenceNode); Live sample This example lets the user select and deselect a paragraph with buttons. Document.
createRange(), Range.selectNodeContents(), and Selection.addRange() are used to select the content. Window.getSelection() and Selection.removeAllRanges() are used to deselect it. HTML <p id="p"><b>Us...
... Living Standard No change. Document O...
Range.setStart() - Web APIs
t log = document.getElementById('log'); // Log info address.childNodes.forEach(node => { const li = document.createElement('li'); li.textContent = `${node.nodeName}, ${node.nodeValue}`; log.appendChild(li); }); // Highlight the street and city const startOffset = 2; // Start at third node: 101 E. Main St. const endOffset = 5; // End at fifth node: Dodge City, KS const range = document.
createRange(); range.setStart(address, startOffset); range.setEnd(address, endOffset); const mark = document.createElement('mark'); range.surroundContents(mark); Result Get characters from a text node This example uses the Range.setStart() and Range.setEnd() methods to define the contents of a range. The resulting range contains the first through fifth characters within a text node. HTML <p id="conte...
...et characters from a text node This example uses the Range.setStart() and Range.setEnd() methods to define the contents of a range. The resulting range contains the first through fifth characters within a text node. HTML <p id="content">0123456789</p> <p id="log"></p> JavaScript const element = document.getElementById('content'); const textNode = element.childNodes[0]; const range = document.
createRange(); range.setStart(textNode, 0); // Start at first character range.setEnd(textNode, 5); // End at fifth character document.getElementById('log').textContent = range; Result Specifications Specification Status Comment DOMThe definition of 'Range.setStart()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal...
Document - Web APIs
name. Document.createElementNS() Creates a new element with the given tag name and namespace URI. Document.createEntityReference() Creates a new entity reference object and returns it. Document.createEvent() Creates an event object. Document.createNodeIterator() Creates a NodeIterator object. Document.createProcessingInstruction() Creates a new ProcessingInstruction object. Document.
createRange() Creates a Range object. Document.createTextNode() Creates a text node. Document.createTouch() Creates a Touch object. Document.createTouchList() Creates a TouchList object. Document.createTreeWalker() Creates a TreeWalker object. Document.enableStyleSheetsForSet() Enables the style sheets for the specified style sheet set. Document.exitPointerLock() Release the pointer lock. D...
Index - Web APIs
for a specified node. 888 Document.createNodeIterator() API, DOM, Gecko, MakeBrowserAgnostic, Method Returns a new NodeIterator object. 889 Document.createProcessingInstruction() API, DOM, Document, Method, Reference, createProcessInstruction createProcessingInstruction() generates a new processing instruction node and returns it. 890 Document.
createRange() API, DOM, DOM Reference, Document, DocumentRange.
createRange, Method, Range The Document.
createRange() method returns a new Range object. 891 Document.createTextNode() API, DOM, Document, Method, Reference, createTextNode Creates a new Text node. This method can be used to escape HTML characters. 892 Document.createTouch() API, DOM, Deprecated, Meth...
Range.cloneContents() - Web APIs
using DOM Events are not copied during cloning. HTML attribute events are duplicated as they are for the DOM Core cloneNode method. HTML id attributes are also cloned, which can lead to an invalid document through cloning. Partially selected nodes include the parent tags necessary to make the document fragment valid. Syntax documentFragment = range.cloneContents(); Example range = document.
createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); documentFragment = range.cloneContents(); document.body.appendChild(documentFragment); Specifications Specification Status Comment DOMThe definition of 'Range.cloneContents()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range Specific...
Range.cloneRange() - Web APIs
The Range.cloneRange() method returns a Range object with boundary points identical to the cloned Range. The returned clone is copied by value, not reference, so a change in either Range does not affect the other. Syntax clone = range.cloneRange(); Example range = document.
createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); clone = range.cloneRange(); Specifications Specification Status Comment DOMThe definition of 'Range.cloneRange()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.cloneRange()' in that specification. Obsolete Initial specification. ...
Range.collapse() - Web APIs
boundary points. A collapsed Range is empty, containing no content, specifying a single-point in a DOM tree. To determine if a Range is already collapsed, see the Range.collapsed property. Syntax range.collapse(toStart); Parameters toStart Optional A Boolean value: true collapses the Range to its start, false to its end. If omitted, it defaults to false . Example var range = document.
createRange(); referenceNode = document.getElementsByTagName("div").item(0); range.selectNode(referenceNode); range.collapse(true); Specifications Specification Status Comment DOMThe definition of 'Range.collapse()' in that specification. Living Standard The parameter is now optional and default to false. Document Object Model (DOM) Level 2 Traversal and Range Speci...
Range.collapsed - Web APIs
r the start and end points of the Range are at the same position. It returns true if the start and end boundary points of the Range are the same point in the DOM, false if not. A collapsed Range is empty (containing no content), and specifies a single point in a DOM tree. To collapse a range, see the Range.collapse() method. Syntax isCollapsed = range.collapsed; Example let range = document.
createRange(); range.setStart(startNode, startOffset); range.setEnd(endNode, endOffset); isCollapsed = range.collapsed; Specifications Specification Status Comment DOMThe definition of 'Range.collapsed' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.collapsed' in that sp...
Range.compareBoundaryPoints() - Web APIs
y-point of sourceRange to the end boundary-point of Range. Range.START_TO_START compares the start boundary-point of sourceRange to the start boundary-point of Range. If the value of the parameter is invalid, a DOMException with a NotSupportedError code is thrown. sourceRange A Range to compare boundary points with the range. Example var range, sourceRange, compare; range = document.
createRange(); range.selectNode(document.getElementsByTagName("div")[0]); sourceRange = document.
createRange(); sourceRange.selectNode(document.getElementsByTagName("div")[1]); compare = range.compareBoundaryPoints(Range.START_TO_END, sourceRange); Specifications Specification Status Comment DOMThe definition of 'Range.compareBoundaryPoints()' in that specification. Living Stand...
Range.comparePoint() - Web APIs
acters from the start of reference node. For other Node types, offset is the number of child nodes between the start of the reference node. Syntax returnValue = range.comparePoint(referenceNode, offset) Parameters referenceNode The Node to compare with the Range. offset An integer greater than or equal to zero representing the offset inside the referenceNode. Example range = document.
createRange(); range.selectNode(document.getElementsByTagName('div').item(0)); returnValue = range.comparePoint(document.getElementsByTagName('p').item(0), 1); Specification Specification Status Comment DOMThe definition of 'Range.comparePoint()' in that specification. Living Standard Initial specification. ...
Range.createContextualFragment() - Web APIs
In the HTML case, if the context node would be html, for historical reasons the fragment parsing algorithm is invoked with body as the context instead. Syntax documentFragment = range.createContextualFragment(tagString) Parameters tagString Text that contains text and tags to be converted to a document fragment. ...
Range.deleteContents() - Web APIs
The Range.deleteContents() method removes the contents of the Range from the Document. Unlike Range.extractContents(), this method does not return a DocumentFragment containing the deleted content. Syntax range.deleteContents() Example range = document.
createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); range.deleteContents(); Specifications Specification Status Comment DOMThe definition of 'Range.deleteContents()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.deleteContents()' in that specification. Obsolete Initial specification. ...
Range.detach() - Web APIs
The Range.detach() method does nothing. It used to disable the Range object and enable the browser to release associated resources. The method has been kept for compatibility. Syntax range.detach(); Example var range = document.
createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); range.detach(); Specifications Specification Status Comment DOMThe definition of 'Range.detach()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.detach()' in that specification. Obsolete Initial specification. ...
Range.endContainer - Web APIs
The Range.endContainer read-only property returns the Node within which the Range ends. To change the end position of a node, use the Range.setEnd() method or a similar one. Syntax endRangeNode = range.endContainer; Example var range = document.
createRange(); range.setStart(startNode,startOffset); range.setEnd(endNode,endOffset); endRangeNode = range.endContainer; Specifications Specification Status Comment DOMThe definition of 'Range.endContainer' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.endContainer' in that specification. Obsolete Initial specification. ...
Range.endOffset - Web APIs
f characters from the start of the endContainer to the boundary point of the Range. For other Node types, the endOffset is the number of child nodes between the start of the endContainer and the boundary point of the Range. This property is read-only. To change the endOffset of a Range, use one of the Range.setEnd methods. Syntax endRangeOffset = range.endOffset; Example var range = document.
createRange(); range.setStart(startNode,startOffset); range.setEnd(endNode,endOffset); endRangeOffset = range.endOffset; Specifications Specification Status Comment DOMThe definition of 'Range.endOffset' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.endOffset' in that sp...
Range.extractContents() - Web APIs
they are for the Node.cloneNode() method. HTML id attributes are also cloned, which can lead to an invalid document if a partially-selected node is extracted and appended to the document. Partially selected nodes are cloned to include the parent tags necessary to make the document fragment valid. Syntax documentFragment = range.extractContents(); Example Basic example var range = document.
createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); var documentFragment = range.extractContents(); document.body.appendChild(documentFragment); Moving items between containers This example lets you move items between two containers. Select one or more item, and then click "swap" to move them to the opposite container. HTML <p id="list1">123456</p> <button id="swap">Swap selec...
Range.getBoundingClientRect() - Web APIs
"highlight"></div> <p>This example positions a "highlight" rectangle behind the contents of a range. The range's content <b>starts here</b> and continues on until it <b>ends here</b>. ...
Range.getClientRects() - Web APIs
The Range.getClientRects() method returns a list of DOMRect objects representing the area of the screen occupied by the range. This is created by aggregating the results of calls to Element.getClientRects() for all the elements in the range. Syntax rectList = range.getClientRects() Example range = document.
createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); rectList = range.getClientRects(); Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Range.getClientRects()' in that specification. Working Draft Initial specification. ...
Range.insertNode() - Web APIs
point of the Range. If the new node is to be added to a text Node, that Node is split at the insertion point, and the insertion occurs between the two text nodes. If the new node is a document fragment, the children of the document fragment are inserted instead. Syntax range.insertNode(newNode); Parameters newNode The Node to insert at the start of the range. Example range = document.
createRange(); newNode = document.createElement("p"); newNode.appendChild(document.createTextNode("New Node Inserted Here")); range.selectNode(document.getElementsByTagName("div").item(0)); range.insertNode(newNode); Specifications Specification Status Comment DOMThe definition of 'Range.insertNode()' in that specification. Living Standard No change Document Object M...
Range.intersectsNode() - Web APIs
The Range.intersectsNode() method returns a boolean indicating whether the given Node intersects the Range. Syntax bool = range.intersectsNode( referenceNode ) Parameters referenceNode The Node to compare with the Range. Example var range = document.
createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); var bool = range.intersectsNode(document.getElementsByTagName("p").item(0)); Specification Specification Status Comment DOMThe definition of 'Range.intersectNode()' in that specification. Living Standard Initial definition. ...
Range.isPointInRange() - Web APIs
od returns a boolean indicating whether the given point is in the Range. It returns true if the point (cursor position) at offset within ReferenceNode is within this range. Syntax bool = range.isPointInRange( referenceNode, offset ) Parameters referenceNode The Node to compare with the Range. offset The offset into Node of the point to compare with the Range. Example range = document.
createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); bool = range.isPointInRange(document.getElementsByTagName("p").item(0),1); Specification Specification Status Comment DOMThe definition of 'Range.isPointInRange()' in that specification. Living Standard Initial definition. ...
Range.selectNode() - Web APIs
The Range.selectNode() method sets the Range to contain the Node and its contents. The parent Node of the start and end of the Range will be the same as the parent of the referenceNode. Syntax range.selectNode(referenceNode); Parameters referenceNode The Node to select within a Range. Example let range = document.
createRange(); let referenceNode = document.getElementsByTagName('div').item(0); range.selectNode(referenceNode); Specifications Specification Status Comment DOMThe definition of 'Range.selectNode()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.selectNode()' in that specification. Obsolete Initial specification. ...
Range.setEnd() - Web APIs
zeError The value specified by endOffset is either greater than or equal to the length of the node or is less than zero. Usage notes If the endNode is a Node of type Text, Comment, or CDataSection, then endOffset is the number of characters from the start of endNode. For other Node types, endOffset is the number of child nodes between the start of the endNode. Example const range = document.
createRange(); const endNode = document.getElementsByTagName('p').item(3); const endOffset = endNode.childNodes.length; range.setEnd(endNode, endOffset); setEnd() is commonly used in conjunction with setStart() to fully configure a range. Specifications Specification Status Comment DOMThe definition of 'Range.setEnd()' in that specification. Living Standard No change. ...
Range.setEndAfter() - Web APIs
The Range.setEndAfter() method sets the end position of a Range relative to another Node. The parent Node of end of the Range will be the same as that for the referenceNode. Syntax range.setEndAfter(referenceNode); Parameters referenceNode The Node to end the Range after. Example var range = document.
createRange(); var referenceNode = document.getElementsByTagName('div').item(0); range.setEndAfter(referenceNode); Specifications Specification Status Comment DOMThe definition of 'Range.setEndAfter()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.setEndAfter()' in that specification. Obsolete Initial specification. ...
Range.setEndBefore() - Web APIs
The Range.setEndBefore() method sets the end position of a Range relative to another Node. The parent Node of end of the Range will be the same as that for the referenceNode. Syntax range.setEndBefore(referenceNode); Parameters referenceNode The Node to end the Range before. Example var range = document.
createRange(); var referenceNode = document.getElementsByTagName("div").item(0); range.setEndBefore(referenceNode); Specifications Specification Status Comment DOMThe definition of 'Range.setEndBefore()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.setEndBefore()' in that specification. Obsolete Initial specification. ...
Range.setStartAfter() - Web APIs
The Range.setStartAfter() method sets the start position of a Range relative to a Node. The parent Node of the start of the Range will be the same as that for the referenceNode. Syntax range.setStartAfter(referenceNode); Parameters referenceNode The Node to start the Range after. Example var range = document.
createRange(); var referenceNode = document.getElementsByTagName("div").item(0); range.setStartAfter(referenceNode); Specifications Specification Status Comment DOMThe definition of 'Range.setStartAfter()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.setStartAfter()' in that specification. Obsolete Initial specification. ...
Range.setStartBefore() - Web APIs
The Range.setStartBefore() method sets the start position of a Range relative to another Node. The parent Node of the start of the Range will be the same as that for the referenceNode. Syntax range.setStartBefore(referenceNode); Parameters referenceNode The Node before which the Range should start. Example var range = document.
createRange(); var referenceNode = document.getElementsByTagName("div").item(0); range.setStartBefore(referenceNode); Specifications Specification Status Comment DOMThe definition of 'Range.setStartBefore()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.setStartBefore()' in that specification. Obsolete Initial specificati...
Range.startContainer - Web APIs
The Range.startContainer read-only property returns the Node within which the Range starts. To change the start position of a node, use one of the Range.setStart() methods. Syntax startRangeNode = range.startContainer; Example range = document.
createRange(); range.setStart(startNode,startOffset); range.setEnd(endNode,endOffset); startRangeNode = range.startContainer; Specifications Specification Status Comment DOMThe definition of 'Range.endContainer' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.startContainer' in that specification. Obsolete Initial specification. ...
Range.startOffset - Web APIs
ffset is the number of characters from the start of the startContainer to the boundary point of the Range. For other Node types, the startOffset is the number of child nodes between the start of the startContainer and the boundary point of the Range. To change the startOffset of a Range, use the Range.setStart method. Syntax startRangeOffset = range.startOffset; Example var range = document.
createRange(); range.setStart(startNode,startOffset); range.setEnd(endNode,endOffset); var startRangeOffset = range.startOffset; Specifications Specification Status Comment DOMThe definition of 'Range.startOffset' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.startOffset...
Range.surroundContents() - Web APIs
ith only one of its boundary points. That is, unlike the alternative above, if there are partially selected nodes, they will not be cloned and instead the operation will fail. Syntax range.surroundContents(newParent); Parameters newParent A Node with which to surround the contents. Example HTML <span class="header-text">Put this in a headline</span> JavaScript const range = document.
createRange(); const newParent = document.createElement('h1'); range.selectNode(document.querySelector('.header-text')); range.surroundContents(newParent); Result Specifications Specification Status Comment DOMThe definition of 'Range.surroundContents()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range Speci...
Range.toString() - Web APIs
() method is a stringifier returning the text of the Range. Alerting the contents of a Range makes an implicit toString() call, so comparing range and text through an alert dialog is ineffective. Syntax text = range.toString(); Example HTML <p>This example logs <b>everything</b> between the bold <b>words</b>. Look at the output below.</p> <p id="log"></p> JavaScript const range = document.
createRange(); range.setStartBefore(document.getElementsByTagName('b').item(0), 0); range.setEndAfter(document.getElementsByTagName('b').item(1), 0); document.getElementById('log').textContent = range.toString(); Result Specifications Specification Status Comment DOMThe definition of 'Range.toString()' in that specification. Living Standard No change. Document Obj...
Range - Web APIs
Range objects can also be retrieved by using the getRangeAt() method of the Selection object or the caretRangeFromPoint() method of the Document object. There also is the Range() constructor available. Properties There are no inherited properties. Range.collapsed Read only Returns a Boolean indicating whether the range's start and end points are at the same position. ...
Rich-Text Editing in Mozilla - Developer guides
e) { oContent = document.createTextNode(oDoc.innerHTML); oDoc.innerHTML = ""; var oPre = document.createElement("pre"); oDoc.contentEditable = false; oPre.id = "sourceText"; oPre.contentEditable = true; oPre.appendChild(oContent); oDoc.appendChild(oPre); } else { if (document.all) { oDoc.innerHTML = oDoc.innerText; } else { oContent = document.
createRange(); oContent.selectNodeContents(oDoc.firstChild); oDoc.innerHTML = oContent.toString(); } oDoc.contentEditable = true; } oDoc.focus(); } function printDoc() { if (!validateMode()) { return; } var oPrntWin = window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes"); oPrntWin.document.open(); oPrntWin.document.
Making content editable - Developer guides
.innerHTML = ""; var oPre = document.createElement("pre"); oDoc.contentEditable = false; oPre.id = "sourceText"; oPre.contentEditable = true; oPre.appendChild(oContent); oDoc.appendChild(oPre); document.execCommand("defaultParagraphSeparator", false, "div"); } else { if (document.all) { oDoc.innerHTML = oDoc.innerText; } else { oContent = document.
createRange(); oContent.selectNodeContents(oDoc.firstChild); oDoc.innerHTML = oContent.toString(); } oDoc.contentEditable = true; } oDoc.focus(); } function printDoc() { if (!validateMode()) { return; } var oPrntWin = window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes"); oPrntWin.document.open(); oPrntWin.document.