Reply
Personal Driving Directions
Old 04-25-2005, 03:57 PM Personal Driving Directions
Junior Talker

Posts: 4
I am building a website and I need to make a form that a user could type there address into and have Yahoo! Driving Directions pop-up in a new window.

Please note I want people to type their address in on my site vs. Yahoo!.

It think it would be easy if you look at the address bar:

http://maps.yahoo.com/dd_result?newa...01&tcountry=us

Could any one give me some help in writing a script that has 2 input fields on my website that would (USERADDRESS and ZIP) and input that information into the link above and open the link in a new window.

NOTE: USERADDRESS can be 1111%20Main%20st

Thanks a lot!!
shindigy is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-25-2005, 04:00 PM
Junior Talker

Posts: 4
It put ... in the link above

So here it is with a return (ignore the two lines):

http://maps.yahoo.com/
dd_result?newaddr=USERADDRESS&taddr=2030+Main+St&c sz=USERZIP&country=us&tcsz=Glastonbury%2C+CT+06033-2901&tcountry=us
shindigy is offline
Reply With Quote
View Public Profile
 
Old 04-25-2005, 07:15 PM What about looking at the source?
Junior Talker

Posts: 4
What about looking at the source and writting a similar one to use on another website?
shindigy is offline
Reply With Quote
View Public Profile
 
Old 04-25-2005, 07:48 PM
Zeal's Avatar
Average Talker

Posts: 17
Location: Texas
HTML Code:
<form name=mapForm2 action="http://us.rd.yahoo.com/maps/home/submit_a/*-http://maps.yahoo.com/maps" method=get>

<div>Enter address or select from My Locations</div><div><small><b>My Locations</b></small>

<small><a href="http://us.rd.yahoo.com/maps/home/fl_signin/*-http://login.yahoo.com/config/login?.src=mp&.intl=us&.done=http://maps.yahoo.com/maps?">Sign In</a></small>
<br><select name="newFL">
<option value="Use Address Below" selected>-- My Locations --</option>
</select>
</div>
<div><small><b>Address</b><br><a href="http://us.rd.yahoo.com/maps/home/intersection/*-http://help.yahoo.com/help/us/maps/maps-14.html">Intersection</a> or <a href="http://us.rd.yahoo.com/maps/home/airport/*-http://help.yahoo.com/help/maps/maps-13.html">Airport Code</a>
<br></small><input maxlength=40 size=25 name="addr" value=""></div>
<div><small><b>City, State or Zip</b><br></small>

<input maxlength=40 size=25 name="csz" value=""></div>

<div><small><b>Country</b></small><br>

<select name="country"><option value="us" selected >United States<option value="ca">Canada</select>

<input type=hidden name="name" value="">
<input type=hidden name="lat" value="">
<input type=hidden name="lon" value=""><input type=hidden name="qty" value="">
<input type=hidden name=srchtype value=a>
</div><div id="test">
<input class=smtbtn type=submit name="getmap" value="Get Map"></div></form>
There's the HTML code that it uses. But, you also need the script that goes along with it. Which is...

Code:
if(document.layers){
	yg_onResizeNS4.w=innerWidth;yg_onResizeNS4.h=innerHeight;
	if(document.embeds.length>0)setInterval("yg_onResize()",200);
	else onresize=yg_onResizeNS4;
}else if((navigator.userAgent.indexOf("Mac")!=-1)&&(document.all)){
	onresize=yg_onResizeMacIE;
}
function yg_onResizeNS4(){
	if(w!=innerWidth||h!=innerHeight)location.reload();
}
function yg_onResizeMacIE(){
	location.reload();
}
function yg_onResizeNS6(){
	location.reload();
}

function ylib_Browser() {
 d=document;
 this.agt=navigator.userAgent.toLowerCase();
 this.major = parseInt(navigator.appVersion);
 this.dom=(d.getElementById)?1:0; // true for ie6, ns6
 this.ns=(d.layers);
 this.ns4=(this.ns && this.major == 4);
 this.ns4up=(this.ns && this.major >=4);
 this.ns6=(this.dom&&navigator.appName=="Netscape");
 this.op=(window.opera? 1:0);
 this.op6= ((this.agt.indexOf("opera 6") > 0) || (this.agt.indexOf("opera/6") > 0));
 this.ie=(d.all);
 this.ie4=(d.all&&!this.dom)?1:0;
 this.ie4up=(this.ie && this.major >= 4);
 this.ie5=(d.all&&this.dom &&  navigator.userAgent.match(/MSIE 5/));
 this.ie6=(d.nodeType)? 1:0;
 this.sf=(this.agt.indexOf("safari")!=-1);
 this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
 this.mac=(this.agt.indexOf("mac")!=-1);
}
var oBw = new ylib_Browser();

function yg_popup(u,n,w,h,k){
        var a=[],o=null,r=arguments;
        a[0]="width="+w+",height="+h;
        a[1]=",scrollbars="+((k&1)?1:0);
        a[2]=",resizable="+((k&2)?1:0);
        a[3]=",toolbar="+((k&4)?1:0);
        a[4]=",status="+((k&8)?1:0);
        a[5]=",location="+((k&16)?1:0);
        a[6]=",menubar="+((k&32)?1:0);
        if(r.length>=6){a[7]=(document.layers)?",screenX="+r[5]:",left="+r[5]}
        if(r.length>=7){a[8]=(document.layers)?",screenY="+r[6]:",top="+r[6]}
        a=a.join("");o=open(u,n,a);o.focus();
        return o;
}

function setFL(field) {
	var val=field.options[field.selectedIndex].value;
	if(val=="Use Address Below") {
		document.mapForm2.addr.value=""
		document.mapForm2.csz.value=""
		return
	}
	var keyValue=val.split("")
	if(keyValue.length < 2) {
		document.mapForm2.addr.value=""
		document.mapForm2.csz.value=""
	}
	var addrArray=keyValue[1].split("");
	if(addrArray[0]&&addrArray[0] != "") {
		document.mapForm2.addr.value=addrArray[0]
		if ( addrArray[0] != keyValue[0] ) 
			document.mapForm2.name.value=keyValue[0]
		else
			document.mapForm2.name.value="";
	}
else {
document.mapForm2.addr.value=""
}
if(addrArray[1]&&addrArray[1] != "") {
document.mapForm2.csz.value=addrArray[1]
}
else {
document.mapForm2.csz.value=""
}
if(addrArray[2]&&addrArray[2]=="ca") {
document.mapForm2.country.selectedIndex=1
}
else if(addrArray[2]&&addrArray[2]=="fr") {
document.mapForm2.country.selectedIndex=2
}
else if(addrArray[2]&&addrArray[2]=="de") {
document.mapForm2.country.selectedIndex=3
}
else if(addrArray[2]&&addrArray[2]=="it") {
document.mapForm2.country.selectedIndex=4
}
else if(addrArray[2]&&addrArray[2]=="sp") {
document.mapForm2.country.selectedIndex=5
}
else if(addrArray[2]&&addrArray[2]=="uk") {
document.mapForm2.country.selectedIndex=6
}
else {
document.mapForm2.country.selectedIndex=0
}
if ( addrArray[3]&&addrArray[3]!= "" ) {
var llValue=addrArray[3].split("")
  if(llValue.length == 2) {
     document.mapForm2.lat.value=llValue[0]
     document.mapForm2.lon.value=llValue[1]
     document.mapForm2.qty.value="12"
  }
}
}
function setCSZ(field) {
var val=field.options[field.selectedIndex].value;
if(val && val != "") {
document.mapForm2.csz.value=val;
}
else {
document.mapForm2.csz.value=""
}
}

function sCookie(sValue) { 

	// alert(sValue);

	var today = new Date();
	var expiry = new Date(today.getTime() + 3650 * 24 * 60 * 60 * 1000); // plus 150 days
	var v_tail = "; expires=" + expiry.toGMTString() + "; domain=maps.yahoo.com";
	var v_cookies = document.cookie;
	// alert(v_cookies);

	if (v_cookies == "") 
	{
		document.cookie = ("YMAP=&Z=" + sValue + v_tail);
		return;
	}

	var v_cookie_arr = v_cookies.split(";");
	var v_cookie_ymap = "";
	var i=0;
	for (i = 0; i < v_cookie_arr.length; i++) 
	{
		// alert( v_cookie_arr[i]);
		if (v_cookie_arr[i].length <= 4) 
			continue;

		// alert( v_cookie_arr[i].substr(1, 5));
		if (v_cookie_arr[i].substr(1, 5) == "YMAP=")
		{
			// alert("found");
			v_cookie_ymap = v_cookie_arr[i]; 
			break;
		}
	}

	// alert( v_cookie_ymap);

	if (v_cookie_ymap == "")
	{
		document.cookie = ("YMAP=&Z=" + sValue + v_tail);
		return;
	}

	var v_ymap_arr = v_cookie_ymap.split("&");
	var v_psect="";
	for (i = 0; i < v_ymap_arr.length; i++) 
	{
		// alert( v_ymap_arr[i]);
		// alert( v_ymap_arr[i].substr(0, 2));

		if (v_ymap_arr[i].substr(0, 2) == "P=")
		{
			// alert("found2");
			v_psect = v_ymap_arr[i];
			break;
		}
	}

	if (v_psect == "")
	{
		document.cookie = ("YMAP=&Z=" + sValue + v_tail);
	}
	else
	{
		document.cookie = ("YMAP=&Z=" + sValue + "&" + v_psect + v_tail);
	}
	
}


function c_ad_click(cat, rd) {
    if (mpoi_is_supported()) {
	var node = document.getElementById(cat);
	if (node) { 
	    node.checked = 1; 
	    var form = node.form;
	    form.rezoom.value = 1;
	    form.action = rd + form.action;
	    form.submit();
	    return false;
	}
    }
    return true;
 }


function traff_state(sState,sType) {
	if(sType != 'hide'){
	if(sState == 'dwn')
		d.getElementById('traffbtn').src="http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/view_02.gif";
	else
		d.getElementById('traffbtn').src="http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/view_01.gif";
	} else {
	if(sState == 'dwn')
                d.getElementById('traffbtn').src="http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/hide_02.gif";
        else
                d.getElementById('traffbtn').src="http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/hide_01.gif";
	}
}
I'm pretty sure you could write a page with the same script and from address. All you have to do is put it on a page with the javascript file linked to the document or in the document that defines the functions.
Zeal is offline
Reply With Quote
View Public Profile Visit Zeal's homepage!
 
Old 04-25-2005, 08:29 PM
Junior Talker

Posts: 4
Thanks for the help, but I new to the scripts, any more help would be nice.
shindigy is offline
Reply With Quote
View Public Profile
 
Old 04-27-2005, 05:56 PM
Zeal's Avatar
Average Talker

Posts: 17
Location: Texas
I'm pretty much inept at javascript. I know how to get by, but advanced stuff is over my head. Hopefully someone else will help you ^_^
Zeal is offline
Reply With Quote
View Public Profile Visit Zeal's homepage!
 
Reply     « Reply to Personal Driving Directions
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16104 seconds with 13 queries