ZennoLab Assemblies Documentation
ReplaceElement Method
Example 
ZennoLab.CommandCenter Namespace > Document Class : ReplaceElement Method

Type: Zennolab.CommandCenter.HtmlElement

The html element to replace all occurrences of oldElement.

Type: Zennolab.CommandCenter.HtmlElement

The html element to be replaced.

All occurrences of a specified html element in the current document replace with another specified html element.
Syntax
public void ReplaceElement( 
   HtmlElement newElement,
   HtmlElement oldElement
)

Parameters

newElement

Type: Zennolab.CommandCenter.HtmlElement

The html element to replace all occurrences of oldElement.

oldElement

Type: Zennolab.CommandCenter.HtmlElement

The html element to be replaced.

Remarks
The IsNull property be true if the html element does not belongs to any document.
Example
The following code example demonstrates ReplaceElement method. Also the following code uses InsertElement method.
// get document
Document doc = tab.MainDocument;
 
// find first element
HtmlElement he1 = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// find second element
HtmlElement he2 = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByName("rad");
 
// if both elements are exist then replace he1 to he2
if (!he1.IsVoid && !he2.IsVoid) doc.ReplaceElement(he2, h1);
// get document
$doc = $tab->MainDocument;
 
// find first element
$he1 = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// find second element
$he2 = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByName("rad");
 
// if both elements are exist then replace he1 to he2
if (!$he1->IsVoid && !$he2->IsVoid) $doc->ReplaceElement($he2, $h1);
Requirements

Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.

See Also

Reference

Document Class
Document Members
HtmlElement Class