Pastes HTML text into the given text range, replacing any previous text and HTML elements in the range.
dhtml语法
TextRange.pasteHTML(sHTMLText)
Parameters
sHTMLText |
Required.
Stringthat specifies the HTML text to paste. The string can contain text and any combination of the HTML tags described in html elements. |
return value
no return value.
remarks
this method might alter the html text to make it fit the given text range. for example, pasting a table cell into a text range that does not contain a table might cause the method to insert a table element. for predictable results, paste only well-formed html text that fits within the given text range.
this method fails only when used inappropriately to paste html into a textarea element in microsoft® internet explorer 5 and later.
this method is accessible at run time. if elements are removed at run time, before the closing tag is parsed, areas of the document might not render.
this feature might not be available on non-microsoft win32® platforms.
DHTML代码范例
This example uses the pasteHTML method to replace the current selection with a new paragraph.
<SCRIPT LANGUAGE="JScript">
var sel = document.selection;
if (sel!=null) {
var rng = sel.createRange();
if (rng!=null)
rng.pasteHTML("<P><B>Selection has been replaced.</B></P>");
}
</SCRIPT>
是否符合公共标准
There is no public standard that applies to this method.
Applies To