質問編集履歴

2

改善

2017/04/21 10:01

投稿

spellbound
spellbound

スコア190

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,36 @@
1
+ # JavascriptでURLから任意の部分だけ取得する方法は?(表題より少し進みました)
2
+
3
+ ```html
4
+
5
+ <script id="src" type="text/javascript" src="example.js?id=123456789" charset="uft-8"></script>
6
+
7
+ ```
8
+
9
+ ```javascript
10
+
11
+ var src = document.getElementById('src');
12
+
13
+ console.log(src.src);
14
+
15
+ ```
16
+
17
+
18
+
19
+ 上記の処理で、「https://example.com/example.js?id=123456789」が取れました。
20
+
21
+ 「123456789」だけ欲しいんですが、どうすれば良いでしょうか?
22
+
23
+
24
+
25
+
26
+
1
27
  # 何が分からないのか
2
28
 
29
+
30
+
31
+ ```scri
32
+
3
- ```<script src="example.js?ex=123456789"></script>```
33
+ ```pt src="example.js?ex=123456789"></script>```
4
34
 
5
35
 
6
36
 

1

誤植

2017/04/21 10:01

投稿

spellbound
spellbound

スコア190

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,6 @@
1
1
  # 何が分からないのか
2
2
 
3
- ```<script src="example.js?ex="123456789"></script>```
3
+ ```<script src="example.js?ex=123456789"></script>```
4
4
 
5
5
 
6
6