jsでの引数の初期値
- <!DOCTYPE html>
- <html lang="ja">
- <head>
- <meta charset="UTF-8">
- <title>jsでの引数の初期値</title>
- <style type="text/css">
- table
- {
- border-collapse:collapse;
- margin:0;
- }
- th, td
- {
- text-align:left;
- vertical-align:top;
- padding:3px 8px;
- font-weight:normal;
- border:1px solid #ccc;
- }
- th
- {
- background:#f3f3f3;
- }
- </style>
- <body>
- <h1>jsでの引数の初期値</h1>
- <script type="text/javascript">
- function initArg(arg)
- {
- arg = arg || "りんご";
- document.write(arg);
- }
-
- initArg();
-
- </script>
- <div style="font-size:10pt;text-align:right;margin-top:0.5em;">
- <a href="//tips.recatnap.info/" target="_top">PCスキルの小技・忘却防止メモ</a> -
- <a href="//tips.recatnap.info/wiki/" target="_top">PCスキルの小技・忘却防止メモのまとめ(wiki)</a>
- </div>
- <div style="font-size:10pt;text-align:center;margin-top:0.5em;padding:0.5em;border-top:1px solid #ccc;">
- Copyright © 2009 by PCスキルの小技・忘却防止メモ. All rights reserved.
- </div>
- </body>
- </html>