-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.php
37 lines (37 loc) · 1.05 KB
/
example.php
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
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>A better load</title>
<style>
.has-js input[type="submit"] {
display: none;
}
</style>
</head>
<body>
<script>
document.body.className+=' has-js';
var hasjsrm=setTimeout(function(){document.body.className=document.body.className.replace(' has-js','')},5000);
</script>
<form action="" method="GET">
<label for="fruit">What is your favorite fruit?</label>
<select id="fruit" name="fruit">
<option disabled>Choose a fruit:</option>
<option value="apples">Apples</option>
<option value="pears">Pears</option>
</select>
<input type="submit" value="Go" />
</form>
<p id="result"><?php if (isset($_GET['fruit'])) echo 'You like ' . $_GET['fruit'] . ', me too!'; ?></p>
</body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script>
$('#fruit').change(function() {
$('#result').text('You like '+ $(this).val() + ', me too!');
});
// These 2 lines must be at the end of your script in case there was an error:
clearTimeout(hasjsrm);
$('body').addClass('has-js');
</script>
</html>