updateSphere();
function updateSphere() {
var sphereNode = document.getElementById('sphere');
var options = {};
if (sphereNode.value == 'moon' ||
sphereNode.value == 'mars')
options = { database: 'http://khmdb.google.com/?db=' + sphereNode.value };
document.getElementById('map3d').innerHTML = '';
google.earth.createInstance('map3d', initCB, failureCB, options);
} Choose a sphere: <select id="sphere" onchange="updateSphere()"> <option value="earth">Earth</option> <option value="mars">Mars</option> <option value="moon">Moon</option> </select>