回答編集履歴
1
追記
test
CHANGED
@@ -1 +1,49 @@
|
|
1
1
|
[JavaScriptで数値を桁区切り (カンマ区切り) にする方法](http://so-zou.jp/web-app/tech/programming/javascript/grammar/data-type/string/comma-formatting.htm)
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
```
|
6
|
+
|
7
|
+
<!DOCTYPE html>
|
8
|
+
|
9
|
+
<html>
|
10
|
+
|
11
|
+
<head>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
|
15
|
+
function count(){
|
16
|
+
|
17
|
+
strPrice = document.getElementById("price")
|
18
|
+
|
19
|
+
console.log(strPrice);
|
20
|
+
|
21
|
+
var i = strPrice.split(',');
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
</script>
|
26
|
+
|
27
|
+
</head>
|
28
|
+
|
29
|
+
<body>
|
30
|
+
|
31
|
+
<p id = "price">
|
32
|
+
|
33
|
+
6,590
|
34
|
+
|
35
|
+
</p>
|
36
|
+
|
37
|
+
<p id = "Number" value = "2" >
|
38
|
+
|
39
|
+
</p>
|
40
|
+
|
41
|
+
<input type="button" onClick = "count()">
|
42
|
+
|
43
|
+
</body>
|
44
|
+
|
45
|
+
</html>
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
たぶんこれでもほぼ同じことしてると思うんですがstrPrice.split(',');でコンソールのほうにエラーありませんか?
|