Google地图标记网址?

I'm having some trouble with giving a Google Maps Marker a URL with the following code.

Let's say I'd just want to add a HREF (to Google.com or something) to the "wpl_map_marker_image" so by clicking the marker image it would go there, how would I add that in the code below?

                    <script type="text/javascript">
                        function wplookInitMap() {
                            // Define the centre of the map and the position of the marker
                            var mapCenter = {
                                lat: <?php echo $wpl_map_latitude; ?>,
                                lng: <?php echo $wpl_map_longitude; ?>
                            };

                            // Define map options
                            var mapOptions = {
                                zoom: <?php echo $wpl_map_zoom; ?>,
                                center: mapCenter,
                                draggable: false,
                                disableDefaultUI: true,
                                scrollwheel: false,
                                <?php echo ( !empty( $wpl_map_snazzy_style ) ? 'styles: ' . $wpl_map_snazzy_style : '' ); ?>
                            };

                            // Generate the map
                            var map = new google.maps.Map( document.getElementById('contactMap'), mapOptions );

                            // Add a marker
                            var beachMarker = new google.maps.Marker( {
                                position: mapCenter,
                                map: map,
                                <?php echo ( !empty( $wpl_map_marker_image ) ? 'icon: \'' . $wpl_map_marker_image . '\'' : '' ); ?>
                            } );

                            // Center the map when the user resizes the window
                            google.maps.event.addDomListener( window, 'resize', function() {
                                map.setCenter( mapCenter );
                            } );
                        }

                        // Generate the map on page load
                        if (!window.addEventListener) { 
                            window.attachEvent('load', wplookInitMap);
                        } else {
                            window.addEventListener('load', wplookInitMap, false);
                        }
                    </script>

Try this,

You can use window.open , as follow

google.maps.event.addListener(beachMarker, 'click', function () {
     window.open("http://google.com/"); 
});

jsFiddel Demo:

http://jsfiddle.net/Lw6tF/14/

Ah thanks, yeah it was called "beachMarker" in my case but your code works.

If anyone needs and reads it in the future, here you go:

<script type="text/javascript">
                            function wplookInitMap() {
                                // Define the centre of the map and the   position of the marker
                                var mapCenter = {
                                    lat: <?php echo $wpl_map_latitude; ?>,
                                    lng: <?php echo $wpl_map_longitude; ?>
                                };

                                // Define map options
                                var mapOptions = {
                                    zoom: <?php echo $wpl_map_zoom; ?>,
                                    center: mapCenter,
                                    draggable: false,
                                    disableDefaultUI: true,
                                    scrollwheel: false,
                                    <?php echo ( !empty( $wpl_map_snazzy_style ) ? 'styles: ' . $wpl_map_snazzy_style : '' ); ?>
                                };

                                // Generate the map
                                var map = new google.maps.Map( document.getElementById('contactMap'), mapOptions );

                                // Add a marker
                                var beachMarker = new google.maps.Marker( {
                                    position: mapCenter,
                                    map: map,
                                    <?php echo ( !empty( $wpl_map_marker_image ) ? 'icon: \'' . $wpl_map_marker_image . '\'' : '' ); ?>
                                } );

                                    google.maps.event.addListener(beachMarker, 'click', function () {
                                     window.open("http://google.com/"); 
                                    } ) ;

                                // Center the map when the user resizes the window
                                google.maps.event.addDomListener( window, 'resize', function() {
                                    map.setCenter( mapCenter );
                                } );
                            }

                            // Generate the map on page load
                            if (!window.addEventListener) { 
                                window.attachEvent('load', wplookInitMap);
                            } else {
                                window.addEventListener('load', wplookInitMap, false);
                            }
                        </script>