New-HTMLAnchor
Creates a new HTML anchor element.
Syntax
New-HTMLAnchor
[[-Class] <String>]
[[-HrefLink] <String>]
[[-Id] <String>]
[[-Name] <String>]
[[-OnClick] <String>]
[[-Style] <IDictionary>]
[[-Target] <String>]
[[-Text] <String>]
[<CommonParameters>]#All Parameter SetsDescription
This function creates a new HTML anchor element (<a>) with specified attributes.
Examples
Example 1
New-HTMLAnchor -Target _parent
Creates an anchor element with the target attribute set to "_parent".New-HTMLAnchor -Id "show_$RandomNumber" -Href '#' -OnClick "show('$RandomNumber');" -Style "color: #ffffff; display:none;" -Text 'Show' Creates an anchor element with specified attributes and text.
Output: <a id="show_$RandomNumber" class="" target="_parent" href="#" onclick="show('$RandomNumber');" style="color: #ffffff; display:none;">Show</a>
Parameters
- -Class String
- The CSS class of the anchor element.
- -HrefLink String
- The URL of the linked document.
- -Id String
- The ID of the anchor element.
- -Name String
- The name of the anchor element.
- -OnClick String
- JavaScript code to execute when the anchor element is clicked.
- -Style IDictionary
- The CSS styles to apply to the anchor element.
- -Target String
- Specifies where to open the linked document.
- -Text String
- The text to display within the anchor element.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.