-
Notifications
You must be signed in to change notification settings - Fork 2
/
lab2.html
executable file
·101 lines (95 loc) · 2.95 KB
/
lab2.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
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Wrapped Set Lab</title>
<link rel="stylesheet" type="text/css" href="support/common.css">
<script type="text/javascript" src="support/jquery-1.2.1.js"></script>
<script type="text/javascript" src="support/support.labs.js"></script>
<script type="text/javascript">
$(function(){
$('#resultsDisplay').hide();
$('#labForm').submit(function(){
try {
var operation = $('#operationField').val();
if (operation.length > 0) {
var wrappedSet = domSampleFrame.performOperation(operation);
$('#wrappedSetSizeDisplay').html('<strong>'+wrappedSet.length+'</strong>');
$('#elementInfoDisplay').html(wrappedSet.formatForDisplay())
$('#resultsDisplay').show();
}
}
catch(e) {
alert('error:'+e);
}
return false;
});
$.get('support/sample.dom.html',function(data){
$('#htmlForSample').html(data.replace(/&/g,'&').replace(/</g,'<').replace(/\n/g,'<br/>').replace(/ /g,' '));
});
$('#operationField').focus();
});
</script>
<style>
#operationFieldset,#domSampleFieldset {
width: 388px;
float: left;
}
#domSampleFieldset {
margin-left: 12px;
}
#domSampleFrame {
width: 368px;
height: 428px;
}
#resultsDisplay {
padding: 2px;
background-color: beige;
}
#elementInfoDisplay {
width: 368px;
color: maroon;
}
#elementInfoDisplay div {
margin-left: 8px;
}
#htmlDisplayFieldset {
clear: both;
width: 809px;
}
#operationField {
width: 95%;
}
</style>
</head>
<body>
<h1>Wrapped Set Lab</h1>
<fieldset id="operationFieldset">
<legend>Operation</legend>
<form id="labForm">
<div>
Type a <strong>valid</strong> jQuery wrapped set operation into the text field below and click the Execute button.
</div>
<div>
<label>Operation:</label><br/>
<textarea rows="3" id="operationField"></textarea>
<br/>
<button type="submit" id="executeButton">Execute</button>
</div>
</form>
<div id="resultsDisplay">
<div>
<label>Wrapped set elements: <span id="wrappedSetSizeDisplay">0</span> element(s)</label>
<div id="elementInfoDisplay"></div>
</div>
</div>
</fieldset>
<fieldset id="domSampleFieldset">
<legend>DOM Sample</legend>
<iframe name="domSampleFrame" id="domSampleFrame" src="support/subpage.wrapped.set.html"></iframe>
</fieldset>
<fieldset id="htmlDisplayFieldset">
<legend>HTML for DOM Sample</legend>
<pre id="htmlForSample"></pre>
</fieldset>
</body>
</html>