JavaScript Google Map It Bookmarklet

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript Google Map It Bookmarklet相关的知识,希望对你有一定的参考价值。

javascript:(function(){function T(f){try{if(f.getSelection)return f.getSelection().toString();if(f.document.selection)return f.document.selection.createRange().text}catch(e){}return ''}function A(f){var t=T(f);if(t)return t;for(var i=0;i<f.length;i++){t=A(f[i]);if(t) return t}return ''}var a=encodeURIComponent(A(window.top).replace(/[
]+/g,", ").replace(/\s+/g," "));if(a)window.open("http://maps.google.com/maps?q="+a)})();

//Here it is expanded so you can read it:
javascript:(function(){
	function T(f)	//get the selected text in frame f
	{
		try{
			if(f.getSelection) return f.getSelection().toString();
			if(f.document.selection) return f.document.selection.createRange().text;
		}catch(e){}	//if the frame is in another domain
		return '';
	}
	function A(f)	//get the selected text in frame f and its children
	{
		var t = T(f);
		if(t) return t;
		for(var i=0; i<f.length; i++)	//for each child frame
		{
			t = A(f[i]);
			if(t) return t;
		}
		return '';
	}
	var a = encodeURIComponent(A(window.top).replace(/[
]+/g, ", ").replace(/\s+/g, " "));
	if(a) window.open("http://maps.google.com/maps?q="+a);
})();

以上是关于JavaScript Google Map It Bookmarklet的主要内容,如果未能解决你的问题,请参考以下文章

使用 google map javascript api v3 在 google map 上添加多个目的地

javascript google map api get city #js #map #filter

javascript google map api get city #js #map #filter

javascript Google Map:以编程方式单击Marker

javascript Google Map API v3 Ghetto示例

JavaScript Google Map自定义,可点击标记的标记