EN
此内容没有您的语言版本,但有英语版本。

publicId property

Gets the public identifier of a document type.

Document Object Model (DOM) Level 3 Core Specification, Section 1.5Internet Explorer 9

 

Syntax

JavaScript

p = object.publicId

 

Property values

Type: String

The public identifier

Standards information

Remarks

The value of the publicId property corresponds to the Availability, Registration, Organization, Type, and Language attributes of a !DOCTYPE directive.

Examples

The following example shows the publicId property with respect to a !DOCTYPE directive.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>IE9 Doctype Sample: PublicId</title>
  <meta name="x-ua-compatible" content="ie=9">
  <script type="text/javascript">
  function showInfo() {
    var s = document.doctype.publicId;
    // Displays "-//W3C//DTD HTML 4.01//EN"
    alert( s );
  }
  </script>
  </head>
  <body>
  <button onclick="showInfo();">Click Me!</button>
  </body>
</html>

See also

documentType
Reference
name
systemId

 

 

显示:
© 2014 Microsoft