質問するログイン新規登録

回答編集履歴

1

追記

2017/04/17 12:23

投稿

toutou
toutou

スコア2052

answer CHANGED
@@ -1,1 +1,25 @@
1
- [JavaScriptで数値を桁区切り (カンマ区切り) にする方法](http://so-zou.jp/web-app/tech/programming/javascript/grammar/data-type/string/comma-formatting.htm)
1
+ [JavaScriptで数値を桁区切り (カンマ区切り) にする方法](http://so-zou.jp/web-app/tech/programming/javascript/grammar/data-type/string/comma-formatting.htm)
2
+
3
+ ```
4
+ <!DOCTYPE html>
5
+ <html>
6
+ <head>
7
+ <script>
8
+ function count(){
9
+ strPrice = document.getElementById("price")
10
+ console.log(strPrice);
11
+ var i = strPrice.split(',');
12
+ }
13
+ </script>
14
+ </head>
15
+ <body>
16
+ <p id = "price">
17
+ 6,590
18
+ </p>
19
+ <p id = "Number" value = "2" >
20
+ </p>
21
+ <input type="button" onClick = "count()">
22
+ </body>
23
+ </html>
24
+ ```
25
+ たぶんこれでもほぼ同じことしてると思うんですがstrPrice.split(',');でコンソールのほうにエラーありませんか?