Hello All,
I have an ASP page that requires javascript to run an IE plug-in, and I have vbscript that reads from a database on the server. In the javascript section I have a function that's called by an HTML link that I build up in the vbscript section. The end result is that after the page loads the user has multiple links they can click on that affect the IE plug-in.
The problem: the built HTML links work fine if I only send numeric data, but I have a string (the name read from the database) that I would like to apply to send to the javascript section as well. I eliminated the IE plug-in from the code so I could isolate the problem but I haven't been able to come up with a solution. So the question is, how do I get my string into the javascript function? Here's the code:
function setLocation(lat, lon, id) {
lat = Number(lat);
lon = Number(lon);
id = Number(id);
//id = String(id);
...
}
and this function is called by the following in the vbscript section:
<code> 'good stuff
'response.write ("<a href=""" & "#" & """ onClick=" & """setLocation(" & rLat & "," & rLong & ")""" & ">" & rID & "</a>")
'trying to get the rID up into the routine
response.write ("<a href=""" & "#" & """ onClick=" & """setLocation(" & rLat & "," & rLong & "," & rID & ")""" & ">" & rID & "</a>") </code>
... assuming that shows up correctly, the values read from the database are rLat, rLong, and rID. rID is the string. Now when I run this, the link shows up fine and shows the rID (name) in the link. The first one does fine, and the second one runs fine if I use a numeric value as the ID. It fails with a string (say the value in the database is Freddy) with the following message:
'Freddy' is undefined
So it's taking the variable contents rather than the variable name. ???
This is probably easy but I haven't figured it out.