开发者

Need help with Javascript....I think

I'm trying to bypass going through a bunch of menus, to get to the data I want directly.

Here are the links I want to go to:

  • http://factfinder.census.gov/servlet/MapItDrawServlet?geo_id=14000US53053072904&tree_id=4001&context=dt&_lang=en&_ts=288363511701
  • factfinder.census.gov/servlet/MapItDrawServlet?geo_id=14000US53025981400&tree_id=4001&context=dt&_lang=en&_ts=288363511701
  • factfinder.census.gov/servlet/MapItDrawServlet?geo_id=14000US53067011620&tree_i开发者_运维百科d=4001&context=dt&_lang=en&_ts=288363511701

Notice, if you pull that up right now, you simply see a GIF outline of the map, however there is no map data "behind" it.

However, if you go to: factfinder.census.gov/servlet/DTGeoSearchByListServlet?ds_name=DEC_2000_SF1_U&_lang=en&_ts=288392632118

  1. Select Geographic Type: ..... ..... Census Tract
  2. Select a State: Washington
  3. Select a County: Pierce
  4. Select one or more geographic areas: Census Tract 729.04
  5. Hit "Map It"

The map will load perfectly. Also, until you close your browser, any of the other links will work perfectly. What I want to do, is be able to bypass these 5 steps, but obviously something is preventing this. Is there a feasible workaround? I have my own domain that I would be able to upload new Javascript or HTML files or whatever is needed.


Looking at the relevant code, there's only a few functions that are needed. The "Map it" button calls the mapit function with a string literal of '/servlet/MapItDrawServlet'.

    function launchMapItServlet(mapItServlet) {
    context = document.form1.context.value;
    lang = "en";
    url = mapItServlet + "?geo_id=" + geo + "&" + "tree_id=" + tree_id + "&context=" + context + "&_lang=" + lang;
    url = getAFFWindowLocation(url, true);
    windowCtr++;
    window.open(url, "identify" + windowCtr, "menubar=yes,scrollbars=yes,resizable=yes,top=10,left=10,width=750,height=550");
}

   function mapItMulti(servlet) {
    if (numberOfSelections(document.forms["form1"].search_results) == 0 || numberOfSelections(document.forms["form1"].search_results) > 1) {
        alert(ALERT_MSG1);
    }
    else if (canMapItMulti(document.forms["form1"].search_results)) {
        index = document.forms["form1"].search_results.selectedIndex;
        geo = document.forms["form1"].search_results.options[index].value;
        tree_id = document.form1["tree_id"].value;
        launchMapItServlet(servlet);
    }
    else {
        alert(ALERT_MSG1);
    }
}

function mapit(mapItServlet) {
    geo = "";

    mapItMulti(mapItServlet);

}

Notice the window.open function which will be the relevant information that you will want to use, especially the 'url' variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜