Advertisement

05.23.2008 at 04:25AM PDT, ID: 23427203
[x]
Attachment Details

How do i add this Javascript?

Asked by Daniish in JavaScript

Tags: Javascript, Firefox 2.0, www.globexposure.net/index_overlay.php

Hello,

At present the lines on my site are generated using code in this format:
gdir.load("from: " + location1 + "to: " + location2 + "to: " + location3) etc

How do i need to modify the attached code snippet so that its appended with:
, {preserveViewport:true};

For example:
gdir.load("from: " + location1 + "to: " + location2 + "to: " + location3, {preserveViewport:true};)


Many thanks for helping meStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
// ========= Now process the polylines ===========
        var lines = xmlDoc.documentElement.getElementsByTagName( "poi_route" );
        // read each line
        for ( var a = 0; a < lines.length; a++ ) {
 
        // get any line attributes
        // var colour = lines[a].getAttribute("colour");
        // var width  = parseFloat(lines[a].getAttribute("width"));
 
        // read each point on that line
        var points = lines[a].getElementsByTagName("point");
        var pts = [];
        var sTo = "";  
        for ( var i = 0; i < points.length; i++ ) {
           pts[ i ] = new GLatLng( parseFloat( points[ i ].getAttribute( "lat" ) ),
                            parseFloat( points[ i ].getAttribute( "lng" ) ) );
           if(i==0) sTo+="from: ";
           else sTo+="to: ";
           sTo+=points[i].getAttribute("lat");
           sTo+=",";
           sTo+=points[i].getAttribute("lng");
           sTo+=" ";
           }
		   
        // map.addOverlay(new GPolyline(pts,colour,width));
        // This draws the straight-line but if i comment it out No route appears for India because GDirections isn't supported there!
		map.addOverlay( new GPolyline( pts ) );
  
        var gdir = new GDirections(map);
        gdir.load(sTo);
        }
        // ================================================
[+][-]05.23.2008 at 04:39AM PDT, ID: 21631101

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 04:55AM PDT, ID: 21631183

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 05:09AM PDT, ID: 21631257

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: Javascript, Firefox 2.0, www.globexposure.net/index_overlay.php
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.23.2008 at 05:11AM PDT, ID: 21631268

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 05:51AM PDT, ID: 21631569

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 06:29AM PDT, ID: 21631890

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 06:43AM PDT, ID: 21632006

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 08:41AM PDT, ID: 21633136

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 08:41AM PDT, ID: 21633140

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628