Pen.applyToNode

Syntax

applyToNode(node: HTMLElement, side: String);

Parameters

node. DOM element, to which border is applied.

side. Border position:

Description

The applyToNode method sets border for the specified DOM element.

Example

To execute the example:

 1. Create an HTML page.

 2. Add links to JS and CSS files in the <head> tag:

 3. Add a code to create a square with the specified right border in the <script> tag:

 <script text="text/javascript">
       function Ready() {
       // Create a div element
       var divElem = PP.createElement(document.body);
       // Set up styles for this element
       divElem.style.width = divElem.style.height = '300px';
       divElem.style.background = 'lightgray';
       // Set border settings
       var pen = new PP.Pen({
           Color: '#f00000',
           Opacity: 0.5,
           Style: PP.PenStyle.Dotted,
           Width: 5,
           });
       pen.applyToNode(divElem, "Right");
       };
 </script>

After executing the example a square with dashed red border at the right is displayed:

See also:

Pen