01.
<html>
02.
<head>
03.
<title>ThaiCreate.Com jQuery Tutorials</title>
04.
<style>
05.
body, select { font-size:12px; }
06.
form { margin:5px; }
07.
p { color:red; margin:5px; font-size:14px; }
08.
b { color:blue; }
09.
</style>
10.
<script type=
"text/javascript"
src=
"jquery-1.6.4.js"
></script>
11.
<script type=
"text/javascript"
>
12.
$(document).ready(
function
(){
13.
14.
function
showValues() {
15.
var
str = $(
"form"
).serialize();
16.
$(
"#results"
).text(str);
17.
}
18.
$(
":checkbox, :radio"
).click(showValues);
19.
$(
"select"
).change(showValues);
20.
showValues();
21.
22.
});
23.
24.
</script>
25.
</head>
26.
<body>
27.
28.
<form>
29.
<select name=
"single"
>
30.
<option>Single</option>
31.
<option>Single2</option>
32.
</select>
33.
34.
<br />
35.
<select name=
"multiple"
multiple=
"multiple"
>
36.
<option selected=
"selected"
>Multiple</option>
37.
<option>Multiple2</option>
38.
39.
<option selected=
"selected"
>Multiple3</option>
40.
</select>
41.
<br/>
42.
<input type=
"checkbox"
name=
"check"
value=
"check1"
id=
"ch1"
/>
43.
44.
<label
for
=
"ch1"
>check1</label>
45.
46.
<input type=
"checkbox"
name=
"check"
value=
"check2"
checked=
"checked"
id=
"ch2"
/>
47.
48.
<label
for
=
"ch2"
>check2</label>
49.
<br />
50.
<input type=
"radio"
name=
"radio"
value=
"radio1"
checked=
"checked"
id=
"r1"
/>
51.
52.
<label
for
=
"r1"
>radio1</label>
53.
<input type=
"radio"
name=
"radio"
value=
"radio2"
id=
"r2"
/>
54.
55.
<label
for
=
"r2"
>radio2</label>
56.
</form>
57.
<p><tt id=
"results"
></tt></p>
58.
59.
</body>
60.
</html>