Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/422.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
仅从javascript以文本形式输出网页_Javascript_Plaintext_Document.write - Fatal编程技术网

仅从javascript以文本形式输出网页

仅从javascript以文本形式输出网页,javascript,plaintext,document.write,Javascript,Plaintext,Document.write,我有一个使用母版页的ASP.NET页面。在这一点上,我有一个脚本,我想做的是重写HTML的输出,只给我一个没有所有HTML标题的街道名称等 这是脚本,你能告诉我怎么做吗 function getAddress(Latitude, Longitude) { var geocoder = new google.maps.Geocoder(); var Lat = parseFloat(Latitude); var Lng = parseFloa

我有一个使用母版页的ASP.NET页面。在这一点上,我有一个脚本,我想做的是重写HTML的输出,只给我一个没有所有HTML标题的街道名称等

这是脚本,你能告诉我怎么做吗

    function getAddress(Latitude, Longitude) {
        var geocoder = new google.maps.Geocoder();
        var Lat = parseFloat(Latitude);
        var Lng = parseFloat(Longitude);
        var latlng = new google.maps.LatLng(Lat, Lng);
        geocoder.geocode({ 'latLng': latlng }, function (results, status) {
            if (status === google.maps.GeocoderStatus.OK) {
                // document.clear();
                document.open();
                document.write(results[0].formatted_address);
                document.close();
            }
            else {
                // Do nothing
                document.open();
                document.write('');
                document.close();
            }
            geocoder = null;
        });
    }
我不必使用母版页(在我发布这个问题后,我可能不使用母版页也可以尝试)

我知道document.write被认为是一种不好的做法,但上面只是我尝试做的一个例子


我将使用HTTP请求等从我的VB.NET应用程序调用此页面。因此,我只想返回一个带有街道名称的纯文本文件。

当您使用ASP.NET加载页面时,将不会执行javascript。 此外,您不能使用javascript更改页面的类型

您可能会找到另一个解决方案,一个更好的解决方案:-)

好的,我真的不需要ASP(更多的是出于习惯,然后我创建了一个ASP页面),所以如果我将其更改为HTML,我可以做我需要的吗?