-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
41 lines (38 loc) · 1.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>OpenAI chat</title>
</head>
<body>
<p>Enter an OpenAI API key and select a version:</p>
<form id="form">
<input
type="text"
placeholder="OpenAI API key"
id="apiKey"
name="apiKey"
/>
<input type="radio" value="native-js" id="native-js" name="version" />
<label for="native-js">
Native JS
</label>
<input type="radio" value="jquery" id="jquery" name="version" />
<label for="jquery">
jQuery
</label>
<button type="submit">Go</button>
</form>
<script>
const form = document.getElementById("form");
function submitForm(event) {
event.preventDefault();
const data = new FormData(form);
const apiKey = data.get("apiKey");
const version = data.get("version");
apiKey && version && location.assign(`./${version}.html?key=${apiKey}`);
}
form.addEventListener("submit", submitForm);
</script>
</body>
</html>