语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -5,7 +5,7 @@
</div></div>
<p>非标准方法 <strong><code>toLocaleFormat()</code></strong> 按特定的格式将一个日期转换成一个字符串。 <a href="Reference/Global_Objects/DateTimeFormat" title="交互示例的源代码存储在 GitHub 资源库。如果你愿意分布交互示例请复制https://github.com/mdn/interactive-examples并向我们发送一个pull请求。"><code>Intl.DateTimeFormat</code></a> 是符合标准的格式化日期的替代方法。另见更新的(newer)版本的 <a href="Reference/Global_Objects/Date/toLocaleDateString" title="toLocaleDateString() 方法返回该日期对象日期部分的字符串该字符串格式因不同语言而不同。新增的参数 locales  options 使程序能够指定使用哪种语言格式化规则允许定制该方法的表现behavior。在旧版本浏览器中 locales 和 options 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。"><code>Date.prototype.toLocaleDateString()</code></a>方法.</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox"><code><var>dateObj</var>.toLocaleFormat(<var>formatString</var>)</code></pre>
<pre><code class="language-javascript"><code><var>dateObj</var>.toLocaleFormat(<var>formatString</var>)</code></code></pre>
<h3 id="参数">参数</h3>
<dl>
<dt><code>formatString</code></dt>
@@ -17,19 +17,19 @@
<p>Also note that the behavior of the used locale depends on the platform, and the user might customize the locale used, so using the system locale the choose the format string might in some cases not even be adequate. You might consider using some of the more general <code>toLocale*</code> methods of the <a href="Reference/Global_Objects/Date" title="The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request."><code>Date</code></a> object or doing your own custom localization of the date to be displayed using some of the <code>get*</code> methods of the <a href="Reference/Global_Objects/Date" title="The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request."><code>Date</code></a> object instead of using this method.</p>
<h2 id="示例">示例</h2>
<h3 id="Using_toLocaleFormat()">Using <code>toLocaleFormat()</code></h3>
<pre class="brush: js">var today = new Date();
<pre><code class="language-javascript">var today = new Date();
var date = today.toLocaleFormat('%A, %B %e, %Y'); // Bad example
</pre>
</code></pre>
<p>In this example, <code>toLocaleFormat()</code> returns a string such as "Wednesday, October 3, 2007". Note that the format string in this example is not properly localized, which will result in the problems described above.</p>
<h2 id="腻子(Polyfill)">腻子(Polyfill)</h2>
<p>When using the <a class="external" href="https://github.com/abritinthebay/datejs/wiki/Format-Specifiers" rel="noopener">DateJS</a> library you can polyfill <a href="Reference/Global_Objects/Date/toLocaleDateString" title="toLocaleDateString() 方法返回该日期对象日期部分的字符串该字符串格式因不同语言而不同。新增的参数 locales  options 使程序能够指定使用哪种语言格式化规则允许定制该方法的表现behavior。在旧版本浏览器中 locales 和 options 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。"><code>Date.prototype.toLocaleDateString()</code></a> like this:</p>
<pre class="brush: js">if (!Date.prototype.toLocaleFormat) {
<pre><code class="language-javascript">if (!Date.prototype.toLocaleFormat) {
(function() {
Date.prototype.toLocaleFormat = function(formatString) {
return this.format(formatString);
};
}());
}</pre>
}</code></pre>
<h2 id="标准">标准</h2>
<p>不属于任何标准。在JavaScript 1.6中被实现。</p>
<h2 id="兼容性">兼容性</h2>