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.

Syntax:

object.nameProp;
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:
<head>
    <script type="text/javascript">
        function GetFileName (){
            var anchor = document.getElementById ("myAnchor");
            alert (anchor.nameProp);
        }
    </script>
</head>
<body>
    <a id="myAnchor" target="_blank" href="http://help.dottoro.com/register.php">
        Dottoro registration form
    </a>
    <button onclick="GetFileName ();">Get the file name of the registration form!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content