Files
openlayers/examples/test.html
euzuro b8f4577a78 example to help fix #186
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1298 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-18 17:30:58 +00:00

83 lines
1.9 KiB
HTML

<html>
<script src="../lib/Prototype.js"></script>
<script type="text/javascript">
var one, two, div, msg;
function init() {
one = $("one");
two = $("two");
div = $("div");
msg = $("msg");
Event.observe(div, "click", bar);
one.checked = true;
two.checked = false;
Event.observe(one, "change", oneClick);
Event.observe(two, "change", twoClick);
}
function bar(e) {
message("clicked div");
Event.stop(e);
var status = "one: ";
status += (one.checked) ? "checked" : "unchecked";
status += " two: ";
status += (two.checked) ? "checked" : "unchecked";
message(status);
}
function oneClick(e) {
message("clicked one");
}
function twoClick(e) {
message("clicked two");
}
function message(txt) {
msg.innerHTML += " ** " + txt;
}
</script>
<body onload="init()" onclick="message('clicked body')" onmouseup="message('<br>')">
<div> The idea here is to simulate the layerswitcher radiobuttons UI
without all the overhead of openlayers.
<br>
<br>
There are event handlers attached to the following elements:
<br>
* Body - Prints message "clicked body" to message area
<br>
* Blue Div - Prints message "clicked div" to message area, stops
the event propagation, prints a message with the
status of the two radiobuttons
<br>
* Radio One - Prints message "clicked one" to message area
<br>
* Radio Two - Prints message "clicked two" to message area
</div>
<div id="div" style="background-color:blue; margin:50px">
<input id="one" type="radio" name="foo"/>
<span> one </span>
<br>
<input id="two" type="radio" name="foo"/>
<span> two </span>
</div>
<div id="msg" style="background-color:pink; margin-top:200px">
Events:
</div>
</body>
</html>