Evotec

Project

PSWriteHTML

PSWriteHTML is an open-source PowerShell project with packages, release history, and working documentation.

Stars 995
Forks 114
Open issues 69
PowerShell Gallery downloads 7,436,513
Release v1.41.0
Language: PowerShell Updated: 2026-04-11

API Reference

Function

New-HTMLAnchor

Aliases: New-HTMLLink
Namespace PSWriteHTML
Aliases
New-HTMLLink

Creates a new HTML anchor element.

Remarks

This function creates a new HTML anchor element (<a>) with specified attributes.

Examples

Authored help example

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>

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.

Syntax

New-HTMLAnchor [-Class <String>] [-HrefLink <String>] [-Id <String>] [-Name <String>] [-OnClick <String>] [-Style <IDictionary>] [-Target <String>] [-Text <String>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Class String optionalposition: 3pipeline: False
The CSS class of the anchor element.
HrefLink String optionalposition: 4pipeline: Falsealiases: Href, Link, Url, UrlLink
The URL of the linked document.
Id String optionalposition: 1pipeline: False
The ID of the anchor element.
Name String optionalposition: 0pipeline: Falsealiases: AnchorName
The name of the anchor element.
OnClick String optionalposition: 5pipeline: False
JavaScript code to execute when the anchor element is clicked.
Style IDictionary optionalposition: 6pipeline: False
The CSS styles to apply to the anchor element.
Target String optionalposition: 2pipeline: False
Specifies where to open the linked document.
Text String optionalposition: 7pipeline: Falsealiases: AnchorText, Value
The text to display within the anchor element.