window.onload = init();
function init() {
map = new OpenLayers.Map("map");
var ol_wms = new OpenLayers.Layer.WMS("OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {
layers: "basic"
});
map.addLayers([ol_wms]);
//this is a simple button
var simpleBtn = new OpenLayers.Control.Button({
displayClass: "simpleBtn",
id: "simpleBtn",
type: OpenLayers.Control.TYPE_BUTTON,
title: "Click me for awsome msg!",
trigger: function () {
var msg = "Hello, I'm pressed!";
console.log(msg);
map.zoomToMaxExtent();
}
});
//this is a toggle button
var simpleToggleBtn = new OpenLayers.Control.Button({
displayClass: "simpleToggleBtn",
id: "simpleToggleBtn",
type: OpenLayers.Control.TYPE_TOGGLE,
title: "Toggle awesomeness on/off",
eventListeners: {
'activate': function () {
console.log("Awesomeness is on! :D");
},
'deactivate': function () {
console.log("Awesomeness is off. :(");
},
}
});
//this is a first tool
var simpleTool1Btn = new OpenLayers.Control.Button({
displayClass: "simpleTool1Btn",
id: "simpleTool1Btn",
type: OpenLayers.Control.TYPE_TOOL,
title: "Tool for owning.",
eventListeners: {
'activate': function () {
console.log("We are now owning. :D");
},
'deactivate': function () {
console.log("We are owning no longer. :'(");
},
}
});
//this is a second tool
var simpleTool2Btn = new OpenLayers.Control.Button({
displayClass: "simpleTool2Btn",
id: "simpleTool2Btn",
type: OpenLayers.Control.TYPE_TOOL,
title: "Tool for ruling.",
eventListeners: {
'activate': function () {
console.log("Our ruling...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.