Results 1 to 2 of 2

Thread: problem map move

  1. #1
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default problem map move

    i made some code
    that is auto map move
    but in for senetenc is error
    THIS code purpose is stop and capture when code array move

    but for senetence is not good
    can you fix
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>map</title> 
    <script type="text/javascript" src="http://apis.daum.net/maps/maps3.js?apikey=966170c5c60229653d09bd765ddbdc2867ab2381" charset="utf-8"></script>
    <script type="text/javascript">
    	function init() {
    		map = new daum.maps.Map(document.getElementById('map'), {
    			center: new daum.maps.LatLng(37.537123, 127.005523),
    			level: 3
    		});
    		
    	}
    	
    	
    	
    	
    function x_pan()
    
    {
    
    	 map.panBy(200 , 0);
    	  
    
    }
    
    
    function y_pan(  )
    
    {
    	
    	
    	 map.panBy(0 , 200 );
    	  
    
    }
    
    	
    	
    	function mpanby() {
    	
    			var xsize =5000 ;
    			var ysize = 5000 ;
    			var fixx = 1000  ;
    			var fixy = 1000  ;
    			var ber =  xsize / fixx ;
    			var yber =  ysize / fixy ;
    			var xnumber  =  parseInt(ber) ;
    			var ynumber  =  parseInt(yber) ;
    	
    		
    		for(var yi = 1; yi <= ynumber; yi++) {
    				
    				
    				
    				
    				
    							for(var i = 1; i <= xnumber; i++) {
    							
                                                                                     
    						
    								x_pan() ;
    
    							}
    						
    					
    				
    						y_pan() ;
    		}
    		
    					
    					
    					
    	}		
    					
    </script>
    </head>
    <body onload="init()">
    	<div id="map" style="width:1600px;height:800px;"></div>
    	
    	<form>
    	<div id="message" style="font-size:12px;width:590px;height:30px;border:solid 1px black;padding:5px;"></div>
    		
    		<button type="button" onclick="mpanby()"> move</button>
    	 
    	</form> 
    </body>
    </html>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,935
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    I think you may just need a valid api key. Is this the error you are getting:

    API 로드 실패: 올바른 Referer가 아닙니다. 등록한 사용URL을 확인하세요
    If so, I'm pretty sure you just need a valid api key. I reworked the code using Google maps which doesn't require a key, at least not for local testing, and it works fine:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>map</title> 
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false" charset="utf-8"></script>
    <script type="text/javascript">
    	function init() {
    		map = new google.maps.Map(document.getElementById('map'), {
    			center: new google.maps.LatLng(37.537123, 127.005523),
    			zoom: 15
    		});
    		
    	}
    	
    	
    	
    	
    function x_pan()
    
    {
    
    	 map.panBy(200 , 0);
    	  
    
    }
    
    
    function y_pan(  )
    
    {
    	
    	
    	 map.panBy(0 , 200 );
    	  
    
    }
    
    	
    	
    	function mpanby() {
    	
    			var xsize =5000 ;
    			var ysize = 5000 ;
    			var fixx = 1000  ;
    			var fixy = 1000  ;
    			var ber =  xsize / fixx ;
    			var yber =  ysize / fixy ;
    			var xnumber  =  parseInt(ber) ;
    			var ynumber  =  parseInt(yber) ;
    	
    		
    		for(var yi = 1; yi <= ynumber; yi++) {
    				
    				
    				
    				
    				
    							for(var i = 1; i <= xnumber; i++) {
    							
                                                                                     
    						
    								x_pan() ;
    
    							}
    						
    					
    				
    						y_pan() ;
    		}
    		
    					
    					
    					
    	}		
    					
    </script>
    </head>
    <body onload="init()">
    	<div id="map" style="width:1600px;height:800px;"></div>
    	
    	<form>
    	<div id="message" style="font-size:12px;width:590px;height:30px;border:solid 1px black;padding:5px;"></div>
    		
    		<button type="button" onclick="mpanby()"> move</button>
    	 
    	</form> 
    </body>
    </html>
    At least there are no errors and the move button works for moving the map. No message appears in the message div, but there's no mention of that div in the javascript code on the page. If you want to use daum maps, then you probably need an account and a key from here:

    http://login.daum.net/accounts/login...daum.net/myapi
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. move text
    By hemi in forum JavaScript
    Replies: 1
    Last Post: 11-13-2009, 10:54 AM
  2. Design problem when move to widescreen
    By loginjoe in forum JavaScript
    Replies: 1
    Last Post: 12-29-2008, 05:59 AM
  3. problem in select list move options
    By giselle2008 in forum JavaScript
    Replies: 1
    Last Post: 01-14-2008, 11:44 PM
  4. Move start
    By DJ0007 in forum JavaScript
    Replies: 3
    Last Post: 08-30-2007, 11:09 PM
  5. Replies: 1
    Last Post: 05-25-2007, 03:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •