-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmp_test1.html.94100~
144 lines (135 loc) · 4.02 KB
/
.tmp_test1.html.94100~
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<DIV id="tabs">
<UL>
<LI><A href="#tabs-1">Interfaces</A></LI>
<LI><A href="#tabs-2">Networks</A></LI>
<LI><A href="#tabs-3">Routes</A></LI>
</UL>
<!-- add wrapper that Layout will auto-size to 'fill space' -->
<DIV class="ui-layout-content ui-corner-bottom">
<DIV id="tabs-1">
<div id="contentPad">
<form>
<input name="status" id="status" value="ip" type="text" onblur="runValidation(this, 'errorMessage');">
<span class="formInfo"><a href="ajax.htm?width=375" class="jTip" id="one" name="IP ADDRESS TIP:">?</a></span>
</form>
<span id="errorMessage" style="color:red;"></span>
<form>
<input name="status" id="status" value="netmask" type="text" onblur="runValidationMask(this, 'errorMessage2');">
<span class="formInfo"><a href="ajax.htm?width=375" class="jTip" id="two" name="NETMASK TIP:">?</a></span>
</form>
<span id="errorMessage2" style="color:red;"></span>
</div>
</DIV>
<DIV id="tabs-2">
<div>
<p>WAN</p>
<select multiple id="select1">
<option value="1">eth1</option>
<option value="2">eth2</option>
<option value="3">eth3</option>
<option value="4">eth4</option>
</select>
<a href="#" id="add">add >></a>
</div>
<div>
<p>LAN</p>
<select multiple id="select2"></select>
<a href="#" id="remove"><< remove</a>
</div>
</DIV>
<DIV id="tabs-3">
<P>Static Routes</P>
</DIV>
</DIV><!--- END content-body --->
</DIV>
<SCRIPT type="text/javascript" src="jtip.js"></SCRIPT>
<script type="text/javascript">
$(document).ready(function() {
$('input[type="text"]').addClass("idleField");
$('input[type="text"]').focus(function() {
$(this).removeClass("idleField").addClass("focusField");
if (this.value == this.defaultValue){
this.value = '';
}
if(this.value != this.defaultValue){
this.select();
}
});
$('input[type="text"]').blur(function() {
$(this).removeClass("focusField").addClass("idleField");
if ($.trim(this.value == '')){
this.value = (this.defaultValue ? this.defaultValue : '');
}
});
$('#add').click(function() {
return !$('#select1 option:selected').remove().appendTo('#select2');
});
$('#remove').click(function() {
return !$('#select2 option:selected').remove().appendTo('#select1');
});
});
function validateIP(el) {
var isValid = true;
var s = el.value.split('.');
var i = 4;
var isValid = (s.length == i);
while (i-- && isValid) {
isValid = (0 <= s[i]) && (s[i] <= 255);
}
return !!isValid;
}
function runValidation(el, id) {
var errorEl = document.getElementById(id);
errorEl.innerHTML = validateIP(el)? '' :
'Invalid IP address';
}
function validateNetMask(mask)
{
//m[0] can be 128, 192, 224, 240, 248, 252, 254, 255
//m[1] can be 128, 192, 224, 240, 248, 252, 254, 255 if m[0] is 255, else m[1] must be 0
//m[2] can be 128, 192, 224, 240, 248, 252, 254, 255 if m[1] is 255, else m[2] must be 0
//m[3] can be 128, 192, 224, 240, 248, 252, 254, 255 if m[2] is 255, else m[3] must be 0
var isValid = true;
var correct_range = {128:1,192:1,224:1,240:1,248:1,252:1,254:1,255:1,0:1};
var m = mask.value.split('.');
var i = 4;
var isValid = (m.length == i);
while (i-- && isValid) {
if (!(m[i] in correct_range)) {
isValid = 0;
break;
}
if ((m[0] == 0) || (m[0] != 255 && m[1] != 0) || (m[1] != 255 && m[2] != 0) || (m[2] != 255 && m[3] != 0)) {
isValid = 0;
}
}
return !!isValid;
}
function runValidationMask(mask, id){
var errorEl = document.getElementById(id);
errorEl.innerHTML = validateNetMask(mask)? '' : 'Invalid Netmask';
}
</script>
<style type="text/css">
@import "global.css";
#status{
width:40%;
padding:5px;
outline:none;
height:15px;
}
.focusField{
border:solid 2px #73A6FF;
background:#EFF5FF;
color:#000;
}
.idleField{
background:#EEE;
color: #6F6F6F;
border: solid 2px #DFDFDF;
}
select {
width: 100px;
height: 100px;
}
</style>