views:

30

answers:

1

My website has a javascript variable (addselectedsubdivision) that loads a neighborhood name from a box on the left to a box on the right. I was hoping I could build a link and then us PHP to add the subdivision letter, neighborhood, and city so that when you click on the link it goes right to this page and loads the neighborhood name in the box on the right. However, I can't get the variable to pass to the new page. Any suggestions?

Website: http://www.mlsfinder.com/va_rein/jonmcachran/index.cfm?primarySearchType=sold&searchType=subdivision&so=a&domain=www.jonsellsvb.com&subdivision_string=p

Example link:

<a href="http://www.mlsfinder.com/va_rein/jonmcachran/index.cfm?primarySearchType=sold&amp;searchType=subdivision&amp;so=a&amp;domain=www.jonsellsvb.com&amp;subdivision_string=$firstletter" onLoad="addselectedsubdivision($neighborhood||$city);" target="_blank">
A: 

What is the onLoad attribute meant to do?

In index.cfm you will need to have coldfusion code that will output a javascript statement based on the query parameters.
So when the serverside sees that it has the arguuments $neighborhood and $city then it will output

...
addselectedsubdivision("cityfromquerystring");
...

This code will have to be contained in an window.onload = function() {...} or equivalent block in order to only be executed after the page has loaded.

Sean Kinsey
Thanks. Another developer did the cold fusion stuff. I was hoping to create an <a href link that "talked" with it. Is it possible to do this and send a javascript variable through an <a href link?
Jon
$neighborhood||$city will give a boolean, don’t know if that is intended. nevertheless, just append the query string like a.href += " (may be passed through encodeURIComponent())
Dormilich
Jon