473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Sending ASP ADO Recordset Value to Javascript Function

I am new to these forums and hope I am in the right place!

I am working on an ASP (3.0) page that displays hotel data from a
recordset in a table. In the last column of each row, I want to include
a button that will send the address information of this hotel to
mapquest to display the map. I have tried several methods for sending
this info, but nothing seems to work.

Here is my code for the javascript function I am calling:

<SCRIPT LANGUAGE="JavaScript">
function goToMapquest(oRSHotels("hotelStreet"), oRSHotels("hotelCity"),
oRSHotels("hotelState"), oRSHotels("hotelZipCode")) {

window.location =
"http://www.mapquest.com/maps/map.adp?searchtype=address&country=US&addtohistory =&searchtab=home&address=<%
=Replace(oRSHotels("hotelStreet"), CHR(32), "+") %>&city=<%
=oRSHotels("hotelCity") %>&state=<% =oRSHotels("hotelState")
%>&zipcode=<% =oRSHotels("hotelZipCode") %>";
}
</script>

This is the table cell:

<td class="Log"><input type="button" value="Map"
onclick="goToMapquest(oRSHotels("hotelStreet"), oRSHotels("hotelCity"),
oRSHotels("hotelState"), oRSHotels("hotelZipCode"))" id=button1
name=button1></td>
This clearly is not working! I am not too familiar with javascripting
and was wondering if there might be a better way to send these
recordset values?

Oct 6 '05 #1
2 2587
"Chris" <cb******@grgce.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am new to these forums and hope I am in the right place!

I am working on an ASP (3.0) page that displays hotel data from a
recordset in a table. In the last column of each row, I want to include
a button that will send the address information of this hotel to
mapquest to display the map. I have tried several methods for sending
this info, but nothing seems to work.

Here is my code for the javascript function I am calling:

<SCRIPT LANGUAGE="JavaScript">
function goToMapquest(oRSHotels("hotelStreet"), oRSHotels("hotelCity"),
oRSHotels("hotelState"), oRSHotels("hotelZipCode")) {

window.location =
"http://www.mapquest.com/maps/map.adp?searchtype=address&country=US&addtohistory =&searchtab=home&address=<%
=Replace(oRSHotels("hotelStreet"), CHR(32), "+") %>&city=<%
=oRSHotels("hotelCity") %>&state=<% =oRSHotels("hotelState")
%>&zipcode=<% =oRSHotels("hotelZipCode") %>";
}
</script>

This is the table cell:

<td class="Log"><input type="button" value="Map"
onclick="goToMapquest(oRSHotels("hotelStreet"), oRSHotels("hotelCity"),
oRSHotels("hotelState"), oRSHotels("hotelZipCode"))" id=button1
name=button1></td>
This clearly is not working! I am not too familiar with javascripting
and was wondering if there might be a better way to send these
recordset values?

Hi Chris,

You're a bit mixed up but almost there! You don't need to get the ADO data
again in your javascript function.

<script type='text/javascript'>
function goToMapquest(street, city, state, zip) {
window.location =
'http://www.mapquest.com/maps/map.adp?searchtype=address&country=US&addtohistory =&searchtab=home&address='
+ street + '&city=' + city + '&state=' + state + '&zipcode=' + zip;
}
</script>

You may need to enclose each variable with the encode() function. e.g..... +
encode(street) + ...

And then in each cell in your table

<td class="Log"><input type="button" value="Map"
onclick="goToMapquest(<%=oRSHotels("hotelStreet")% >,<%=oRSHotels("hotelCity")%>,<%=oRSHotels("hotelS tate")%>,<%oRSHotels("hotelZipCode")%>)"
id=button1 name=button1></td>

HTH
Martin
Oct 7 '05 #2
"Chris" <cb******@grgce.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am new to these forums and hope I am in the right place!

I am working on an ASP (3.0) page that displays hotel data from a
recordset in a table. In the last column of each row, I want to include
a button that will send the address information of this hotel to
mapquest to display the map. I have tried several methods for sending
this info, but nothing seems to work.


[snip]

http://www.aspfaq.com/5003
Oct 7 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kingdom | last post by:
I have a SelectBoxes.asp page that is working with multiple selection dropdown boxes to extract data and total the selection prices. Tom & Bob were kind enough to give me a big help getting this...
3
by: John Kenickney | last post by:
I use ASP/Javascript. I pull a date from a recordset field like this. var theDate = new Date() theDate = rs.Fields.Item("date").value Now I want to apply the method toLocaleString(). There are...
5
by: Simone | last post by:
Hello I hope you guys can help me. I am very new to ADO... I am creating a ADODB connection in a module and trying to access it from a command button in a form. Function fxEIDAssgn(plngEID As...
1
by: anniefs | last post by:
hi help me i m so much stuck int he code and i have no time .... i used ASP VBscipt and javascript functions with MS database javascript function add records in MS DB by using ASP vbscript...
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
4
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, thanks for your help yesterday, I've got one more question, then I think I'm done for now,... Is it possible to insert recordset data in a javascript, for instance I have a javascript...
2
by: lstanikmas | last post by:
Hi, I'm validating a form with this ASP but receiving some blank email responses; does anyone see anything wrong with it?: function isFormVarExcluded(thisForm, strToCheck) { var strExcludeVars...
1
by: shivasusan | last post by:
Hi Friends! Please Help me! How i can solve this error? Please explain me, what is the error and how to solve? Error Type: ADODB.Recordset (0x800A0E7D) The connection cannot be used to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.