Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   Web Design and Hosting (http://www.mac-forums.com/forums/web-design-hosting/)
-   -   Help with JavaScript and PhoneBook widget (http://www.mac-forums.com/forums/web-design-hosting/19960-help-javascript-phonebook-widget.html)

garymm 06-09-2005 03:07 AM

Help with JavaScript and PhoneBook widget
 
For starters, I have very limited experience with JavaScript. That out of the way, I want to modify the phonebook widget so that when I click on an address, I get directions to it rather than a map of it. The pertinent section of PhoneBook.js (or at least this is the only thing that I think is pertinent but I have no idea how to use javascript) follows (can be accessed via the "show package contents" on the PhoneBook widget file in Library/Widgets):

var mapURL = "http://www.mapquest.com/maps/map.adp?country=us&address=";

mapURL += URLEncode( singleResult.address );
mapURL += "&city=";
mapURL += URLEncode( singleResult.city );
mapURL += "&state=";
mapURL += URLEncode( singleResult.state );
mapURL += "&zip=";
mapURL += URLEncode( singleResult.zip );

addressSpansContainer.setAttribute("maplink", mapURL );
addressSpansContainer.onclick = function(event)
{
if( window.widget )
widget.openURL(this.getAttribute("maplink"));
}

Here are the mapquest guidelines for creating a link to directions (instead of a map): link

I can figure out how to simply enter my home address into the base URL and have it permanently stored in the PhoneBook.js, but what I really want is a way to make it check my address from my card in Address Book. Is there a way to do this with JavaScript or at all?

Thanks for the help. I will definitely share the edited widget.


All times are GMT -4. The time now is 11:25 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.