-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery4.html
311 lines (219 loc) · 9.39 KB
/
jquery4.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JQuery Tutorial</title>
<style type="text/css">
.highlight { background-color: yellow; }
</style>
<!-- Get the JQuery library
Jquery 1 & 2 are the same except JQuery 2 doesn't
support IE 6, 7, and 8 -->
<<<<<<< HEAD
<script src="jquery.min.js"></script>
<link rel="stylesheet" href="jquery-ui.css">
<script src="jquery-ui.min.js"></script>
=======
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
>>>>>>> 54fa96c9ea8736c920b6362cb6c1bda0138b6695
</head>
<body>
<div id="wrapper">
<h1>Random Stuff</h1>
<p id="p_one"><img src="ntt-logo.png" id="logo2" alt="NTT Logo" height="180" width="180">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <em>Aenean pretium</em>, ipsum quis ultrices aliquet, lacus urna ultrices odio, eu interdum tortor tortor quis ligula. <a href="#">Morbi finibus</a> auctor ipsum vel tempus. Nullam gravida leo ac iaculis pretium. <b>In pretium varius nisi</b>, quis tristique ipsum semper vitae. Mauris eu aliquet odio. Pellentesque tristique sem turpis, id gravida nunc consequat vel. <a href="#">Nullam nec condimentum magna</a>. Sed dignissim interdum risus ac mattis. In hac habitasse platea dictumst. Vivamus placerat tristique vestibulum. Pellentesque quis eleifend nisl. Quisque mollis aliquam enim eu ullamcorper.</p>
<p id="p_two">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pretium, ipsum quis ultrices aliquet, lacus urna ultrices odio, eu interdum tortor tortor quis ligula. <a href="mailto:derekbanas@verizon.net">Morbi finibus</a> auctor ipsum vel tempus. Nullam gravida leo ac iaculis pretium. In pretium varius nisi, quis tristique ipsum semper vitae. Mauris eu aliquet odio. Pellentesque tristique sem turpis, id <a href="http://google.com">gravida nunc consequat</a> vel. Nullam nec condimentum magna. Sed dignissim interdum risus ac mattis. <a href="http://www.newthinktank.com/wordpress/PersonalityTest.pdf">In hac habitasse</a> platea dictumst. Vivamus placerat tristique vestibulum. Pellentesque quis eleifend nisl. Quisque mollis aliquam enim eu ullamcorper.</p>
<p id="p_three">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <i>Aenean pretium,</i> ipsum quis ultrices aliquet, lacus urna ultrices odio, eu interdum tortor tortor quis ligula.</p>
<table id="tableData">
<caption>Baseball</caption>
<thead>
<tr>
<td colspan="4">Best Baseball Players</td>
</tr>
</thead>
<tfoot>
<tr><td colspan="4">* Hall of Fame</td></tr>
</tfoot>
<tbody>
<tr>
<td></td>
<td>Average</td>
<td>RBIs</td>
<td>Homeruns</td>
</tr>
<tr>
<td><a href="#">Hank Aaron*</a></td>
<td>.305</td>
<td>2297</td>
<td>755</td>
</tr>
<tr>
<td><a href="#">Babe Ruth*</a></td>
<td>.342</td>
<td>2214</td>
<td>714</td>
</tr>
<tr>
<td><a href="#">Barry Bonds</a></td>
<td>.298</td>
<td>1996</td>
<td>762</td>
</tr>
</tbody>
</table>
<h2 id="bestSelling">Best Selling Childrens Books</h2>
<ol id="oListTypes">
<li>Harry Potter
<ol id="oListIndent">
<li>and the Sorcerer's Stone</li>
<li>and the Half-Blood Prince</li>
<li>and the Chamber of Secrets</li>
<li>Prisoner of Azkaban</li>
<li name="best_book">and the Goblet of Fire</li>
<li>and the Order of the Phoenix</li>
<li>and the Deathly Hallows</li>
</ol>
</li>
<li>The Very Hungry Caterpillar</li>
</ol>
<input type="text" id="yourName" size="50">
<input type="text" id="listStuff" size="50"><br />
<h2 id="trackEvents">Tracking Events</h2>
Mouse Click : X : <input type="text" id="mClickXPos">
Y : <input type="text" id="mClickYPos"><br />
Mouse Move : X : <input type="text" id="mMoveXPos">
Y : <input type="text" id="mMoveYPos"><br />
Key Pressed : <input type="text" id="keyPressed"><br />
<span id="formEvent">Form Event</span> : <input type="text" id="inputFormEvent"><br /><br />
<img src="1.jpg" id="accident" alt="accident">
<div id="jsonData"></div>
<button type="button" id="getData">Get Data</button>
<script type="text/javascript">
$("document").ready(function() {
$("#wrapper").css("width", 500);
$("#wrapper").css("margin", "auto");
$("#logo2").css("float", "left");
$("#p_two").css("color", "green");
$("#p_two").css({"background" : "url('2.jpg') repeat-y"});
$("a").css("color", "red");
$("#tableData a").css("color", "green");
$("em + a").css("color", "orange");
$("p > em").css("color", "gray");
$("#oListIndent li:nth-child(3)").css("color", "red");
$("li[name]").html("'and the Goblet of Fire'");
$("input[type='text']#yourName").val("Derek");
$("a[href*='google']").css("font-weight", "bolder");
$("img[alt^='NTT']").css({"border-color": "black",
"border-width":"1px",
"border-style":"solid"});
$("a[href^='http://g']").css("color", "cyan");
$("a[href^='mailto:']").css("color", "yellow");
$("img[alt^='NTT']").width(150)
.height(150);
$("a[href$='pdf']").css("color", "red");
$("#tableData tr:even").css("background-color", "#FFFDD0");
$("#tableData tr:odd").css("background-color", "#F0F8FF");
$("#tableData tr:first").css({"background-color" : "#001A57", "color" : "white"});
$("#tableData tr:last").css("background-color", "#FFC0DB");
$("#oListTypes li:not(:contains(and))").css("color", "red");
$("a:contains(gravida)").css("color", "blue");
$("p:has(i)").hide();
alert($("p:has(i)").html());
$("p:has(i)").html("<i>Some normal text</i>").show();
$("p:has(i)").append(" I go at the end");
$("p:has(i)").prepend("I go at the beginning ");
$("p:has(i)").before("<p id='before_p'>A new paragraph before</p>");
$("p:has(i)").after("<p id='after_p'>A new paragraph after</p>");
$("#after_p").click(function(){
$(this).remove()
});
$("#before_p").click(function(){
$(this).replaceWith('<p>i m new to this</p>')
});
$("#oListIndent li").each(function(index) {
var inputListStuff = $("#listStuff").val();
$("#listStuff").val(inputListStuff + ", " + $(this).text());
});
$("#oListIndent li").addClass("Harry_Potter");
$(".Harry_Potter").css("color", "green");
$("#oListIndent li").click(function() {
$(this).toggleClass("highlight");
var bgColor = $(this).css("background-color");
$("input[type=text]#yourName").val(bgColor);
});
$("#logo2").click(function() {
var imgName = $(this).attr("src");
$("input[type=text]#yourName").val(imgName);
$("#logo2").attr("src", "ntt-logo-horz.jpg");
});
$("#logo2").mouseover(function() {
$("#logo2").attr("src", "ntt-logo-horz.jpg");
});
$("#logo2").mouseout(function() {
$("#logo2").attr("src", "ntt-logo.jpg");
});
$("h2").hover(function() {
$("h2").css("color", "green");
}, function() {
$("h2").css("color", "black");
});
$("#logo2").dblclick(function() {
$("#logo2").attr("src", "ntt-logo.jpg");
});
$(document).click(function(e) {
$("#mClickXPos").val(e.pageX);
$("#mClickYPos").val(e.pageY);
});
$(document).mousemove(function(e) {
$("#mMoveXPos").val(e.screenX);
$("#mMoveYPos").val(e.screenY);
});
$(document).keypress(function(e){
var keyPressed = String.fromCharCode(e.which)
$("#keyPressed").val(keyPressed);
});
$("#inputFormEvent").blur(function() {
$("#formEvent").text("Left Input Element");
});
$("#inputFormEvent").change(function() {
$("#formEvent").text("Input Element Changed");
});
$("#inputFormEvent").focus(function() {
$("#formEvent").text("Input Element Focused");
});
$("#inputFormEvent").select(function() {
$("#formEvent").text("Input Element Selected");
});
function showWhatTouched(e){
alert(e.data.message);
}
var bsMsg = { message:"Best Selling Touched" };
var teMsg = { message:"Track Events Touched" };
$("#bestSelling").on("mouseover", bsMsg, showWhatTouched);
$("#trackEvents").on("mouseover", teMsg, showWhatTouched);
var accidentImgs = ["1.jpg", "2.jpg", "3.jpg", "4.jpg"];
var focusImg = 1;
$("#accident").click(function() {
var image = accidentImgs[focusImg];
focusImg++;
if(focusImg > 3){
focusImg = 0;
}
$("#accident").attr("src", image);
});
<<<<<<< HEAD
$("#p_one").click(function() {
$(this).hide();
});
=======
>>>>>>> 54fa96c9ea8736c920b6362cb6c1bda0138b6695
});
</script>
</div> <!-- End of wrapper -->
<!-- Most common CSS attributes
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
background, background-attachment, background-color, background-image, background-repeat, border, border-bottom, border-color, border-style, border-bottom-color, border-bottom-style, border-bottom-width, border-left-color, border-left-style, border-left-width, border-right-color, border-right-style, border-right-width, border-top-color, border-top-style, border-top-width, box-shadow, color, columns, direction, float, font-family, font-size, font-style, font-weight, height, letter-spacing, line-height, list-style-type, list-style-image, list-style-position, margin, margin-bottom, margin-top, margin-right,margin-left, opacity, padding-bottom, padding-top, padding-right, padding-left, text-align, text-decoration, text-decoration-color, text-decoration-line, text-decoration-style, text-indent, text-orientation, text-shadow, text-transform, vertical-align, visibility, width, word-spacing, z-index
-->
</body>
</html>