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.
<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.