Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-02-2012, 01:51 PM   PM User | #1
Phillymajigay
New to the CF scene

 
Join Date: Dec 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Phillymajigay is an unknown quantity at this point
Javascript Geolocation - Help Needed

Hi all,

Was hoping someone could help me. I'm creating a map using the Google map api with drop down boxes to various locations. I have the longitude and latitude of said locations & created an array. The problem i'm having is how to 'wire up' the locations to the drop down box and for them then to present themselves within the map canvas.

Any help would be appreciated

Kind Regards,

Pippa
Phillymajigay is offline   Reply With Quote
Old 12-02-2012, 09:02 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 453 Times in 451 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
It sounds simple enough EXCEPT for the fact that I have no idea what you are trying to do, or what "wiring up" may entail. Can you explain what you want to happen when the user selects an option? And show us what your array looks like?
xelawho is offline   Reply With Quote
Old 12-02-2012, 10:04 PM   PM User | #3
donna1
New Coder

 
Join Date: Nov 2012
Location: london
Posts: 55
Thanks: 5
Thanked 1 Time in 1 Post
donna1 can only hope to improve
small demo
Code:
<!DOCTYPE HTML>
<html>
<body>
<canvas id="myCanvas" width="800" height="600">>Your browser does not support the canvas tag.</canvas>
<script>
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');

var stores = ["Handbags","Hairdressers","Clothes","McDonalds"];
var storex = [50,200,510,300];
var storey = [400,100,50,200];
var i=0;

function displayStore(){
 canvas.width=canvas.width;
 ctx.beginPath();
 ctx.rect(storex[i],storey[i],75,25);
 ctx.closePath();
 ctx.stroke();
 ctx.fillText(stores[i],storex[i]+5,storey[i]+15);
}

function rotateStores(){
 displayStore();
 i++;
 if(i==stores.length){ i=0;}
}

setInterval("rotateStores()",1000);

</script>
</body>
</html>

Last edited by donna1; 12-02-2012 at 10:32 PM..
donna1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:27 AM.


Advertisement
Log in to turn off these ads.