You are here: Reference > JavaScript > client-side > HTML DOM > properties > nameProp (a, img)

nameProp property (a, img)

Browser support:
Returns the file name from the URL specified by the href or src property of the current element.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the name of the file.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the nameProp property:
    <script type="text/javascript">
        function GetFileName (){
            var anchor = document.getElementById ("myAnchor");
            alert (anchor.nameProp);
    <a id="myAnchor" target="_blank" href="">
        Dottoro registration form
    <button onclick="GetFileName ();">Get the file name of the registration form!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content