diff options
| author | Irvin <irvinfly@gmail.com> | 2022-02-16 02:03:27 +0800 |
|---|---|---|
| committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
| commit | 012ee621791b6895e637f96e6523027951768f25 (patch) | |
| tree | 29cfacc0d5092af45870dcc74f22feb8b2664fbf /files/zh-cn/web/javascript/reference/global_objects/date | |
| parent | ba91b017421b001cd226135612a7bd5dfcd88904 (diff) | |
| download | translated-content-012ee621791b6895e637f96e6523027951768f25.tar.gz translated-content-012ee621791b6895e637f96e6523027951768f25.tar.bz2 translated-content-012ee621791b6895e637f96e6523027951768f25.zip | |
remove inline style for zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/date')
14 files changed, 53 insertions, 53 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html index 4bbfc8ad23..5f7d438415 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getDate()</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.getDate()</code></pre> <h2 id="Parameters" name="Parameters">参数</h2> @@ -27,14 +27,14 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate <h3 id="Example:_Using_getDate" name="Example:_Using_getDate">例子: 使用getDate()<code>方法</code></h3> -<p>下面第二条语句将值25赋给 day 变量,该值基于日期对象 <code style="font-style: normal; line-height: 1.5;">Xmax95</code>的值。</p> +<p>下面第二条语句将值25赋给 day 变量,该值基于日期对象 <code>Xmax95</code>的值。</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:00"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:00"); var day = Xmas95.getDate(); alert(day); // 25</code></pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -63,11 +63,11 @@ alert(day); // 25</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getDate")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCDate()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html index e9b18b852e..b2ee4a80cd 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;"><em>dateObj</em>.getDay()</code> +<pre class="syntaxbox language-html"><code class="language-html"><em>dateObj</em>.getDay()</code> </pre> <h3 id="Description" name="Description">返回值</h3> @@ -26,7 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay <p>下面第二条语句,基于{{jsxref("Date")}}对象 <code>Xmas95</code> 的值,把 1 赋值给 <code>weekday</code>。也就是说1995年12月25日是星期一。</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:30"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:30"); var weekday = Xmas95.getDay(); console.log(weekday); // 1</code></pre> @@ -41,7 +41,7 @@ console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95)); // Montag</code></pre> </div> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -73,11 +73,11 @@ console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95)); </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getDay")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCDate()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getfullyear/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getfullyear/index.html index 7c4cf29b9a..6b8638c52d 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getfullyear/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getfullyear/index.html @@ -21,7 +21,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getFullYear <h2 id="Syntax" name="Syntax">语法</h2> -<pre style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getFullYear()</code> +<pre><code class="language-html">dateObj.getFullYear()</code> </pre> <h3 id="Description" name="Description">返回值</h3> @@ -42,7 +42,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getFullYear var year = today.getFullYear(); </pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -74,11 +74,11 @@ var year = today.getFullYear(); </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getFullYear")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCFullYear()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html index eb8ad854e1..fda9396354 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getHours <h2 id="语法">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><var>dateObj</var>.getHours()</pre> +<pre class="syntaxbox language-html"><var>dateObj</var>.getHours()</pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -29,12 +29,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getHours <p>下面第二条语句,基于日期对象 <code>Xmas95 </code>的值,把 23 赋值给了变量 <code>hours。</code></p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:00"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:00"); var hours = Xmas95.getHours(); alert(hours); // 23</code></pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -61,11 +61,11 @@ alert(hours); // 23</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getHours")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCHours()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html index be3ebe8f9b..c5dd09e3d9 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><var>dateObj</var>.getMilliseconds()</pre> +<pre class="syntaxbox language-html"><var>dateObj</var>.getMilliseconds()</pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -29,11 +29,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds <p>下例中,将当前时间的毫秒数赋值给变量 <code>ms</code>。</p> -<pre class="brush: js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var ms; +<pre class="brush: js language-js"><code class="language-js">var ms; Today = new Date(); ms = Today.getMilliseconds();</code></pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -60,11 +60,11 @@ ms = Today.getMilliseconds();</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getMilliseconds")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCMilliseconds()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html index 7a1fd0f433..8322a9e813 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMinutes <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getMinutes()</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.getMinutes()</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -27,10 +27,10 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMinutes <p>下例中,第二行语句运行过后,变量 <code>minutes </code>的值为15,也就是说 <code>Xmas95 </code>这个日期对象的值为某时15分某秒。</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:00"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:00"); var minutes = Xmas95.getMinutes();</code></pre> -<p dir="ltr"><strong style="font-size: 2.142857142857143rem; font-weight: 700; letter-spacing: -1px; line-height: 30px;">规范</strong></p> +<p dir="ltr"><strong>规范</strong></p> <table class="standard-table"> <tbody> @@ -57,13 +57,13 @@ var minutes = Xmas95.getMinutes();</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p> </p> <p>{{Compat("javascript.builtins.Date.getMinutes")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCMinutes()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html index 0002ecf4a1..63a953f263 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html @@ -79,7 +79,7 @@ console.log(month); // 11</pre> <p>{{Compat("javascript.builtins.Date.getMonth")}}</p> </div> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCMonth()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html index 457f166047..ded6203208 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getSeconds <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getSeconds()</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.getSeconds()</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -29,14 +29,14 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getSeconds <p>下面第二条语句,基于日期对象 <code>Xmas95</code> 的值,把 30 赋值给变量 <code>secs</code>。</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:30"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:30"); var secs = Xmas95.getSeconds();</code></pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: transparent;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: transparent;"> </div> +<div class="line-number"> </div> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -63,11 +63,11 @@ var secs = Xmas95.getSeconds();</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getSeconds")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCSeconds()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html index 87b619c759..7ee056a7df 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getTimezoneOffset()</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.getTimezoneOffset()</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/index.html index 2c8e41406b..764d868453 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/index.html @@ -45,7 +45,7 @@ new Date(<var>year</var>, <var>monthIndex</var> [, <var>day</var> [, <var>hours< <h4 id="时间戳字符串">时间戳字符串</h4> </dt> <dt><code>dateString</code></dt> - <dd>表示日期的字符串值。该字符串应该能被 {{jsxref("Date.parse()")}} 正确方法识别(即符合 <a href="http://tools.ietf.org/html/rfc2822#page-14" style="white-space: pre-line;">IETF-compliant RFC 2822 timestamps</a> 或 <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15">version of ISO8601</a>)。 + <dd>表示日期的字符串值。该字符串应该能被 {{jsxref("Date.parse()")}} 正确方法识别(即符合 <a href="http://tools.ietf.org/html/rfc2822#page-14">IETF-compliant RFC 2822 timestamps</a> 或 <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15">version of ISO8601</a>)。 <div class="note"> <p><strong>注意:</strong> 由于浏览器之间的差异与不一致性,强烈不推荐使用<code>Date</code>构造函数来解析日期字符串 (或使用与其等价的<code>Date.parse</code>)。对 RFC 2822 格式的日期仅有约定俗成的支持。 对 ISO 8601 格式的支持中,仅有日期的串 (例如 "1970-01-01") 会被处理为 UTC 而不是本地时间,与其他格式的串的处理不同。</p> </div> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html index ad8ffc0c33..c8fcb530ab 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/setFullYear <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.setFullYear(yearValue[, monthValue[, dayValue]])</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.setFullYear(yearValue[, monthValue[, dayValue]])</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -36,7 +36,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/setFullYear <h3 id="Example:_Using_setFullYear" name="Example:_Using_setFullYear">例子:使用<code>setFullYear</code>方法</h3> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var theBigDay = new Date(); +<pre class="brush:js language-js"><code class="language-js">var theBigDay = new Date(); theBigDay.setFullYear(1997);</code></pre> <h2 id="规范">规范</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/tolocalestring/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/tolocalestring/index.html index e351f33c33..a5b2885180 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/tolocalestring/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/tolocalestring/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleString --- <div>{{JSRef("Global_Objects", "Date")}}</div> -<p><code><strong>toLocaleString()</strong></code> 方法返回该日期对象的字符串,该字符串格式因不同语言而不同。新增的参数 <code style="font-style: normal; line-height: 1.5;">locales</code> 和 <code style="font-style: normal; line-height: 1.5;">options</code> 使程序能够指定使用哪种语言格式化规则,允许定制该方法的表现(behavior)。在旧版本浏览器中, <code style="font-style: normal; line-height: 1.5;">locales</code> 和 <code style="font-style: normal; line-height: 1.5;">options</code> 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。</p> +<p><code><strong>toLocaleString()</strong></code> 方法返回该日期对象的字符串,该字符串格式因不同语言而不同。新增的参数 <code>locales</code> 和 <code>options</code> 使程序能够指定使用哪种语言格式化规则,允许定制该方法的表现(behavior)。在旧版本浏览器中, <code>locales</code> 和 <code>options</code> 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。</p> <div>{{EmbedInteractiveExample("pages/js/date-tolocalestring.html")}}</div> @@ -17,7 +17,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleString <h3 id="Parameters" name="Parameters">参数</h3> -<p>查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code style="font-style: normal;">locales</code> 和 <code style="font-style: normal;">options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p> +<p>查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code>locales</code> 和 <code>options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p> <p>{{page('zh-CN/docs/JavaScript/Reference/Global_Objects/DateTimeFormat','Parameters')}}</p> @@ -42,7 +42,7 @@ date.toLocaleString(); <h3 id="Example:_Checking_for_support_for_locales_and_options_arguments" name="Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</h3> -<p><code style="font-style: normal;">locales</code> 和 <code style="font-style: normal;">options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code style="font-style: normal;">RangeError</code> 异常,反之会忽略参数。</p> +<p><code>locales</code> 和 <code>options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code>RangeError</code> 异常,反之会忽略参数。</p> <pre class="brush: js">function toLocaleStringSupportsLocales() { try { @@ -56,7 +56,7 @@ date.toLocaleString(); <h3 id="Example:_Using_locales" name="Example:_Using_locales">例子:使用 <code>locales</code> 参数</h3> -<p>下例展示了本地化日期格式的一些变化。为了在应用的用户界面得到某种语言的日期和时间格式,必须确保使用 <code style="font-style: normal;">locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p> +<p>下例展示了本地化日期格式的一些变化。为了在应用的用户界面得到某种语言的日期和时间格式,必须确保使用 <code>locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p> <pre class="brush: js">var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); @@ -90,7 +90,7 @@ alert(date.toLocaleString(["ban", "id"])); <h3 id="Example:_Using_options" name="Example:_Using_options">例子:使用 <code>options</code> 参数</h3> -<p>可以使用 <code style="font-style: normal;">options </code>参数来自定义 <code style="font-style: normal;">toLocaleString</code> 方法返回的字符串。</p> +<p>可以使用 <code>options </code>参数来自定义 <code>toLocaleString</code> 方法返回的字符串。</p> <pre class="brush: js">var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/tolocaletimestring/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/tolocaletimestring/index.html index 2f31d53e2d..cf32bed733 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/tolocaletimestring/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/tolocaletimestring/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString --- <div>{{JSRef("Global_Objects", "Date")}}</div> -<p>The <code><strong>toLocaleTimeString()</strong></code> 方法返回该日期对象时间部分的字符串,该字符串格式因不同语言而不同。新增的参数 <code style="font-style: normal; line-height: 1.5;">locales</code> 和 <code style="font-style: normal; line-height: 1.5;">options</code> 使程序能够指定使用哪种语言格式化规则,允许定制该方法的表现(behavior)。在旧版本浏览器中, <code style="font-style: normal; line-height: 1.5;">locales</code> 和 <code style="font-style: normal; line-height: 1.5;">options</code> 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。</p> +<p>The <code><strong>toLocaleTimeString()</strong></code> 方法返回该日期对象时间部分的字符串,该字符串格式因不同语言而不同。新增的参数 <code>locales</code> 和 <code>options</code> 使程序能够指定使用哪种语言格式化规则,允许定制该方法的表现(behavior)。在旧版本浏览器中, <code>locales</code> 和 <code>options</code> 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。</p> <div>{{EmbedInteractiveExample("pages/js/date-tolocaletimestring.html")}}</div> @@ -17,7 +17,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString <h3 id="Parameters" name="Parameters">参数</h3> -<p>查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code style="font-style: normal;">locales</code> 和 <code style="font-style: normal;">options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p> +<p>查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code>locales</code> 和 <code>options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p> <p>{{page('zh-US/docs/JavaScript/Reference/Global_Objects/DateTimeFormat','Parameters')}}</p> @@ -38,7 +38,7 @@ alert(date.toLocaleTimeString()); <h3 id="Example:_Checking_for_support_for_locales_and_options_arguments" name="Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 支持情况</h3> -<p><code style="font-style: normal;">locales</code> 和 <code style="font-style: normal;">options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code style="font-style: normal;">RangeError</code> 异常,反之会忽略参数。</p> +<p><code>locales</code> 和 <code>options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code>RangeError</code> 异常,反之会忽略参数。</p> <pre class="brush: js">function toLocaleTimeStringSupportsLocales() { try { @@ -52,7 +52,7 @@ alert(date.toLocaleTimeString()); <h3 id="Example:_Using_locales" name="Example:_Using_locales">例子:使用 <code>locales</code> 参数</h3> -<p>下例展示了本地化时间格式的一些变化。为了在应用的用户界面得到某种语言的时间格式,必须确保使用 <code style="font-style: normal;">locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p> +<p>下例展示了本地化时间格式的一些变化。为了在应用的用户界面得到某种语言的时间格式,必须确保使用 <code>locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p> <pre class="brush: js">var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); @@ -83,7 +83,7 @@ alert(date.toLocaleTimeString(["ban", "id"])); <h3 id="Example:_Using_options" name="Example:_Using_options">例子:使用 <code>options</code> 参数</h3> -<p>可以使用 <code style="font-style: normal;">options </code>参数来自定义 <code style="font-style: normal;">toLocaleTimeString</code> 方法返回的字符串。</p> +<p>可以使用 <code>options </code>参数来自定义 <code>toLocaleTimeString</code> 方法返回的字符串。</p> <pre class="brush: js">var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/totimestring/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/totimestring/index.html index b99486c6b6..faa183e9cf 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/totimestring/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/totimestring/index.html @@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toTimeString <p>{{jsxref("Global_Objects/Date", "Date")}} 对象的实例引用一个具体的时间点。 调用 {{jsxref("Date.toString", "toString")}} 方法以美式英语和人类易读的形式,返回日期对象的格式化字符串。在 <a href="/en-US/docs/SpiderMonkey" title="SpiderMonkey">SpiderMonkey</a> 里,该字符串由日期部分(年月日)和其后的时间部分(时分秒和时区)组成。有时会需要获取时间部分的字符串,这可以由 <code>toTimeString</code> 方法完成。</p> -<p>The <code style="font-style: normal;">toTimeString</code> method is especially useful because compliant engines implementing <a href="https://developer.mozilla.org/en-US/docs/ECMAScript" title="ECMAScript">ECMA-262</a> may differ in the string obtained from <code style="font-style: normal;">toString</code> for <code style="font-style: normal;">Date</code> objects, as the format is implementation-dependent; simple string slicing approaches may not produce consistent results across multiple engines.</p> +<p>The <code>toTimeString</code> method is especially useful because compliant engines implementing <a href="https://developer.mozilla.org/en-US/docs/ECMAScript" title="ECMAScript">ECMA-262</a> may differ in the string obtained from <code>toString</code> for <code>Date</code> objects, as the format is implementation-dependent; simple string slicing approaches may not produce consistent results across multiple engines.</p> <h2 id="Example" name="Example">例子</h2> |
