-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredirect.html
66 lines (62 loc) · 2.39 KB
/
redirect.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<style>
input[type="text"] {
width: 3ch;
}
input[type="text2"]{width: 5ch;}
</style>
</head>
<body>
<form>
<label for="inputBox1">192.168.</label>
<input type="text" id="inputBox1" name="inputBox1" maxlength="3">
<label for="inputBox2">.</label>
<input type="text" id="inputBox2" name="inputBox2" maxlength="3">
<label for="inputBox3">:</label>
<input type="text2" id="inputBox3" name="inputBox3" maxlength="5" placeholder="Port">
<label for="inputBox4">/</label>
<input type="text0" id="inputBox4" name="inputBox4" placeholder="Path">
<br><br>
<p id="urlPreview"></p>
<br>
<input type="button" value="ACCESS" onclick="redirect()">
</form>
<script>
window.addEventListener('load', updatePreview);
function updatePreview() {
var input1 = document.getElementById('inputBox1').value;
var input2 = document.getElementById('inputBox2').value;
var input3 = document.getElementById('inputBox3').value;
var input4 = document.getElementById('inputBox4').value;
var url = 'http://192.168.' + input1 + '.' + input2;
if (input3) {
url += ':' + input3;
}
if (input4) {
url += '/' + input4;
}
document.getElementById('urlPreview').textContent = url;
}
function redirect() {
var input1 = document.getElementById('inputBox1').value;
var input2 = document.getElementById('inputBox2').value;
var input3 = document.getElementById('inputBox3').value;
var input4 = document.getElementById('inputBox4').value;
var url = 'http://192.168.' + input1 + '.' + input2;
if (input3) {
url += ':' + input3;
}
if (input4) {
url += '/' + input4;
}
window.location.href = url;
}
document.getElementById('inputBox1').addEventListener('input', updatePreview);
document.getElementById('inputBox2').addEventListener('input', updatePreview);
document.getElementById('inputBox3').addEventListener('input', updatePreview);
document.getElementById('inputBox4').addEventListener('input', updatePreview);
</script>
</body>
</html>