[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using string value.

Posted on 2007-07-24
2
Medium Priority
?
2,029 Views
Last Modified: 2010-05-18
I am using a web page to capture some information and then posting it to another web page.  In this web page I am using the information from the other page to then go find the lat/lon of a point.  To you guys/gals two numbers.  I want to use this lat/lon to center my map to the right place using this line.  I've captured this information in two places.  Two text boxes (txtlat, txtlon) and strlat, strlon.
I would like to take something like this:
        var myLatLon = new AWLatLon(42.367044, -71.052742);
Change it to something like this
        var myLatLon = new AWLatLon(strlat, strlon);

Keeping my code as much as it is, how can I do this?  I know I am missing something simple. Below is the rest of the code.  The code works fine when I hard code the numbers.

<html>
    <head>
        Competitive Events Form

            <!--  reference to the ArcWeb Explorer JavaScript library -->
             <script src="http://www.arcwebservices.com/awx2lab/awxapi-2.0-beta1.js" type="text/javascript"></script>


         <script type="text/javascript">
         function onBodyLoad()
         {
         AWUtils.insertMap("explorer", "API Key");
         }
         function onCreationComplete()
         {
         var myExplorer = new AWMap("explorer");
         var myLatLon = new AWLatLon(42.367044, -71.052742);
         myExplorer.centerAndScale(myLatLon, 10000);
         }
         </script>




        <%dim strDivision, strStore, strLat, strLon
        dim strDataPath, strConnectString, objConnection,  objRS, strSelected

        strStore = Request.Form("selStore")
        strDivision = Request.Form("selDivision")

        strDataPath = server.MapPath("\Databases\MonthlySales.mdb")  
        strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;"_
                          + " Data Source= " & strDataPath & ";"_
                          + " Mode=Share Deny None;User Id=admin;PASSWORD=;"
                          
        if not IsObject("ojbConnection") then
              set objConnection=Server.CreateObject("ADODB.Connection")
              objConnection.ConnectionTimeout = 15
              objConnection.CommandTimeout =  10
              objConnection.Mode = 3 'adModeReadWrite
              if objConnection.State = 0 then
                    objConnection.Open strConnectString
              end if
        end if

        'Get Latitude and Longitude
        if strStore = "" Then
              Response.Write "You did not choose any criteria to search on.  Click below to make your selections: <BR>"
              %><INPUT type=button value="New Search" id=btnNewSearch name=btnNewSearch onClick='location="http://ho000xd3840571/CE/CompetitiveEvents_Stores.asp";'><%
           
        else
                  if not isObject("objRS") then
                        set objRS=Server.CreateObject("ADODB.RecordSet")
                  end if
                  
        'objRS.Open "SELECT MONTHLYOLD.*, MONTHLYOLD.[Division Letter Code], MONTHLYOLD.[Store Name] FROM MONTHLYOLD WHERE (((MONTHLYOLD.[Division Letter Code])='MCF') AND ((MONTHLYOLD.[Store Name])='Bradenton'));",objConnection,3,3
        objRS.Open "SELECT MONTHLYOLD.[Division Letter Code], MONTHLYOLD.[Store Name], MONTHLYOLD.Latitude, MONTHLYOLD.Longitude FROM MONTHLYOLD WHERE (((MONTHLYOLD.[Division Letter Code])='MCF') AND ((MONTHLYOLD.[Store Name])='Bradenton'));",objConnection,3,3
                              do while not objRS.EOF
                              strLat = objRS("Latitude")
                              strLon = objRS("Longitude")
                              'response.write objRS("Latitude") & objRS("Longitude")
                                objRS.MoveNext
                              Loop
                                    'Close and dereference database objects
                              objRS.Close
                              set objRS=Nothing
        end if
        %>
    </head>

<body onLoad="onBodyLoad()">
<form>

    Latitude: <input id="txtLat" type="txtLat" value="<%response.write strLat %>"/>      
    <br />
    Longitude: <input id="txtLon" type="txtLon" value="<%response.write strLon %>"/>      
    <br />
       
        Division Name: <%response.write strDivision %>
        <BR>
        Store Name: <%response.write strStore %>

            <br />
            <br />
            <br />
            <br />
        <center>
        <div align="center" id="explorer" style="width:800px; height:600px;">You need at least <a href="http://www.adobe.com/go/getflashplayer">Adobe Flash 9 Player or higher</a> to view this page.</div>

        </center>
</form>
    </body>
</html>
0
Comment
Question by:flfmmqp
2 Comments
 
LVL 9

Accepted Solution

by:
ftaco96 earned 2000 total points
ID: 19557497
You'll need to move the javascript after the ASP stuff, and then you can do this...

<script>
         var myExplorer;
         function onCreationComplete()
         {
                  myExplorer = new AWMap("explorer");
                  var myLatLon = new AWLatLon(<%response.write strLon %>, <%response.write strLon %>);
                  myExplorer.centerAndScale(myLatLon, 10000);
         }
         function changeLatLon()
         {
                  var lat = frmLatLon.txtLat.value;
                  var lon = frmLatLon.txtLon.value;
                  var myLatLon = new AWLatLon(lat,lon);
                  myExplorer.centerAndScale(myLatLon, 10000);
         }
</script>

give the form an id...
<form id="frmLatLon">

and you can put an onchange event in the textboxes...
    Latitude: <input id="txtLat" type="txtLat" value="<%response.write strLat %>" onchange="changeLatLon();"/>      
    <br />
    Longitude: <input id="txtLon" type="txtLon" value="<%response.write strLon %>" onchange="changeLatLon();"/>      
    <br />
0
 

Author Comment

by:flfmmqp
ID: 19558087
Thanks for the help!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question