my overall goal is to load an image given user lattitude and longitude. However, my code has an error logic somewhere I assume (document.write("Dog") is never displaying to the screen) so I have to assume something is going wrong. The user is being prompted for a lat and longitude after clicking the button but afterwards nothing is happening. Any Ideas what might be going on? I'm a beginner so i am sure it is something simple.
<body>
<p>Click the button to demonstrate the prompt box.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x;
var latittude = prompt("Please enter a lat");
var longitude = prompt("please enter your longitude");
var img = document.createElement('img');
img.src = 'http://maps.googleapis.com/maps/api/streetview?size=400x400&location='+ latittude + ',' + longitude + '&heading=235&sensor=false';
img.height = 200;
img.width = 300;
img.alt = alt;
document.write(img.src);
document.write("dog");
document.getElementById('body').appendChild(img);
}
</script>
</body>