-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc-chooser.php
54 lines (47 loc) · 1.19 KB
/
doc-chooser.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
if (array_key_exists("url", $_GET))
$url = $_GET["url"];
else
$url = "";
?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<form method="POST" action="go.php" target="doc-<?php echo $_GET["side"]; ?>">
<input id="user-url" name="user-url" style="width: 95%" value="<?php echo $url; ?>">
<select id="url" name="url">
<option value="">Pasirinkite įstatymą...</option>
<?php
$laws = json_decode(file_get_contents(dirname(__FILE__) . "/laws.json"));
foreach ($laws->data as $law) {
echo '<option value="' . $law[1] . '"';
if ($url == $law[1])
echo ' selected';
echo '>';
echo htmlspecialchars($law[2]);
echo '</option>' . "\n";
}
?>
</select>
<input type="submit" value="rodyti">
</form>
<script type="text/javascript">
var user_url = document.getElementById("user-url");
if (!user_url.value) {
user_url.value = "Įveskite adresą...";
user_url.onfocus = function() {
user_url.value = "";
user_url.onfocus = undefined;
}
}
var url = document.getElementById("url");
if (!url.onchange) {
url.onchange = function() {
user_url.value = "";
}
}
</script>
</body>
</html>