質問編集履歴

3

何を試したのかについて追加しました。

2016/02/06 11:22

投稿

Shinnosukeuesak
Shinnosukeuesak

スコア8

test CHANGED
File without changes
test CHANGED
@@ -76,4 +76,102 @@
76
76
 
77
77
  inputに翔太と入力してエンターボタンを押すと、http://dokkiri.com
78
78
 
79
- に行くプログラムを作りました。うまくいったので、これを応用して、グーグルのhtmlに組み込めないか試したみたのですが、うまくいきません。解決策を教えてください。私は初心者なので、問題に不備があったら、教えてください。
79
+ に行くプログラムを作りました。うまくいったので、これを応用して、グーグルのhtmlに組み込めないか試したみたのですが、うまくいきません。
80
+
81
+ どのように試したのかというと、
82
+
83
+
84
+
85
+ 本物グーグルのhtmlに
86
+
87
+
88
+
89
+ ```html
90
+
91
+ <input class="gsfi" id="lst-ib" maxlength="2048" name="q" autocomplete="off"
92
+
93
+ title="Search" type="text" value="" aria-label="Search" aria-haspopup="false"
94
+
95
+ role="combobox" aria-autocomplete="both" dir="ltr" spellcheck="false"
96
+
97
+ style="border: none; padding: 0px; margin: 0px; height: auto; width: 100%;
98
+
99
+ position: absolute; z-index: 6; left: 0px; outline: none; background:
100
+
101
+ url(&quot;data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAA
102
+
103
+ ICRAEAOw%3D%3D&quot;) transparent;">
104
+
105
+ ```
106
+
107
+
108
+
109
+ このように書かれていたのに、onKeyDown="if(event.keyCode==13) kk(event); を付け足して、
110
+
111
+
112
+
113
+ ```html
114
+
115
+ <input class="gsfi" id="lst-ib" onKeyDown="if(event.keyCode==13) kk(event);
116
+
117
+ maxlength="2048" name="q" autocomplete="off"
118
+
119
+ title="Search" type="text" value="" aria-label="Search" aria-haspopup="false"
120
+
121
+ role="combobox" aria-autocomplete="both" dir="ltr" spellcheck="false"
122
+
123
+ style="border: none; padding: 0px; margin: 0px; height: auto; width: 100%;
124
+
125
+ position: absolute; z-index: 6; left: 0px; outline: none; background:
126
+
127
+ url(&quot;data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAA
128
+
129
+ ICRAEAOw%3D%3D&quot;) transparent;">
130
+
131
+ ```
132
+
133
+
134
+
135
+ このように変えました。さらに、headタブの中に新しく、
136
+
137
+
138
+
139
+ ```html
140
+
141
+ <script language="javascript" type="text/javascript">
142
+
143
+
144
+
145
+ function kk(e){
146
+
147
+ lol = document.getElementById('lst-ib').value;
148
+
149
+
150
+
151
+ if(/翔太/.test(lol)){
152
+
153
+ window.location="http://dakkiri.com";
154
+
155
+ }
156
+
157
+
158
+
159
+ }
160
+
161
+
162
+
163
+ </script>
164
+
165
+ ```
166
+
167
+
168
+
169
+ を付け足しました。
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+ 解決策を教えてください。私は初心者なので、問題に不備があったら、教えてください。

2

script タブを閉じました

2016/02/06 11:22

投稿

Shinnosukeuesak
Shinnosukeuesak

スコア8

test CHANGED
File without changes
test CHANGED
@@ -50,6 +50,8 @@
50
50
 
51
51
  }
52
52
 
53
+ <script>
54
+
53
55
 
54
56
 
55
57
 

1

間違えていたところを直しました・

2016/02/06 11:15

投稿

Shinnosukeuesak
Shinnosukeuesak

スコア8

test CHANGED
File without changes
test CHANGED
@@ -72,92 +72,6 @@
72
72
 
73
73
 
74
74
 
75
- 文字を書く箱に翔太と書いてエンターボタンを押すと、http://dokkiri.com
75
+ inputに翔太と入力してエンターボタンを押すと、http://dokkiri.com
76
76
 
77
- に行くプログラムを作りました。うまくいったので、これを応用し、
78
-
79
- 本物グーグルのhtmlに
80
-
81
-
82
-
83
- ```html
84
-
85
- <input class="gsfi" id="lst-ib" maxlength="2048" name="q" autocomplete="off"
86
-
87
- title="Search" type="text" value="" aria-label="Search" aria-haspopup="false"
88
-
89
- role="combobox" aria-autocomplete="both" dir="ltr" spellcheck="false"
90
-
91
- style="border: none; padding: 0px; margin: 0px; height: auto; width: 100%;
92
-
93
- position: absolute; z-index: 6; left: 0px; outline: none; background:
94
-
95
- url(&quot;data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAA
96
-
97
- ICRAEAOw%3D%3D&quot;) transparent;">
98
-
99
- ```
100
-
101
-
102
-
103
- このように書かれていたのに、onKeyDown="if(event.keyCode==13) kk(event); を付け足して、
104
-
105
-
106
-
107
- ```html
108
-
109
- <input class="gsfi" id="lst-ib" onKeyDown="if(event.keyCode==13) kk(event);
110
-
111
- maxlength="2048" name="q" autocomplete="off"
112
-
113
- title="Search" type="text" value="" aria-label="Search" aria-haspopup="false"
114
-
115
- role="combobox" aria-autocomplete="both" dir="ltr" spellcheck="false"
116
-
117
- style="border: none; padding: 0px; margin: 0px; height: auto; width: 100%;
118
-
119
- position: absolute; z-index: 6; left: 0px; outline: none; background:
120
-
121
- url(&quot;data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAA
122
-
123
- ICRAEAOw%3D%3D&quot;) transparent;">
124
-
125
- ```
126
-
127
-
128
-
129
- このように変えました。さらに、headタブの中に新しく、
130
-
131
-
132
-
133
- ```html
134
-
135
- <script language="javascript" type="text/javascript">
136
-
137
-
138
-
139
- function kk(e){
140
-
141
- lol = document.getElementById('lst-ib').value;
142
-
143
-
144
-
145
- if(/翔太/.test(lol)){
146
-
147
- window.location="http://dakkiri.com";
148
-
149
- }
150
-
151
-
152
-
153
- }
154
-
155
-
156
-
157
- </script>
158
-
159
- ```
160
-
161
-
162
-
163
- 付け足しました。しかし、うまくいかず翔太と検索窓に書かい普通検索結果出てきます。なぜうまくいかないのか、可能なのか、それと解決策を教えてください。私は初心者なので、問題に不備があったら、教えてください。
77
+ に行くプログラム作りました。うまくいったのでこれを応用して、グーグルhtmlに組み込めないか試したみたのですうまくいきません。解決策を教えてください。私は初心者なので、問題に不備があったら、教えてください。