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

質問編集履歴

3

編集

2020/10/14 13:22

投稿

bot73145848
bot73145848

スコア5

title CHANGED
File without changes
body CHANGED
@@ -7,23 +7,26 @@
7
7
  ### 発生している問題・エラーメッセージ
8
8
 
9
9
  ```
10
- Uncaught ReferenceError: N is not defined
10
+ Uncaught TypeError: document.getElementById(...).charAt is not a function
11
- at kaibun (練習2.html:8)
11
+ at kaibun (練習2.html:10)
12
- at HTMLButtonElement.onclick (練習2.html:19)
12
+ at HTMLButtonElement.onclick (練習2.html:22)
13
13
  ```
14
14
 
15
15
  ### 該当のソースコード
16
16
 
17
17
  ```javascript
18
+
18
- <!DOCTYPE html>
19
+ <!DOCTYPE html>
19
20
  <html lang="ja">
20
21
  <head>
21
22
  <meta charset="UTF-8">
22
23
  <script>
23
24
  function kaibun(){
25
+ let N=0;
26
+ let total=0;
24
27
  let l=document.getElementById("source").length;
25
28
  let n=document.getElementById("source").charAt(N);
26
- let total=0;
29
+
27
30
 
28
31
  for(let i=0;i<=l;i=n(l-1)-2n*(i++)){
29
32
  total+=i;

2

誤字

2020/10/14 13:22

投稿

bot73145848
bot73145848

スコア5

title CHANGED
File without changes
body CHANGED
@@ -21,13 +21,14 @@
21
21
  <meta charset="UTF-8">
22
22
  <script>
23
23
  function kaibun(){
24
+ let l=document.getElementById("source").length;
25
+ let n=document.getElementById("source").charAt(N);
24
- let l=source.length;
26
+ let total=0;
25
- let n=source.charAt(N);
26
27
 
27
- for(let i=n(l-1);i<=n;i=-2n*(i++)){
28
+ for(let i=0;i<=l;i=n(l-1)-2n*(i++)){
28
29
  total+=i;
29
30
  }
30
-
31
+ document.getElementById("total").textContent = result;
31
32
  }
32
33
  </script>
33
34
  </head>

1

誤字

2020/10/14 13:07

投稿

bot73145848
bot73145848

スコア5

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,6 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- ここに質問の内容を詳しく書いてください。
3
+
4
4
  javascriptで回文を作るページを作っています(回文を判定するものではありません)。
5
5
  回文を作る公式的なものは分かりましたが、全く動きません...
6
6
 
@@ -45,4 +45,4 @@
45
45
 
46
46
  ### 補足情報(FW/ツールのバージョンなど)
47
47
 
48
- ここにより詳細な情報を記載してください
48
+ ブラウザはchrome、ツールはVisual Studio Codeです