Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7597187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:05:57+00:00 2026-05-30T22:05:57+00:00

All, I’ve got the following code: <script type=text/javascript> function Store( lat, long, text )

  • 0

All,
I’ve got the following code:

<script type="text/javascript">
function Store( lat, long, text )
{
    this.latitude = lat;
    this.longitude = long;
    this.html = text;
}

var myStores = [<?php echo $jsData;?>, null];
addLoadEvent(loadMap);

This is populated with the following code:

$lat = $post->latitude;
$long = $post->longitude;
$post_id = $post->ID;
$get_post_info = get_post($post_id); 
$name = $get_post_info->post_title;
$jsData = $jsData . "new Store( $lat, $long, '$name' ),\n";

My page loads fine without the javascript portion. However when I add the javascript I get the following error:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; MS-RTC LM 8; AskTbAD2/5.14.1.20007)
Timestamp: Wed, 22 Feb 2012 16:45:35 UTC

Message: Arg: Illegal input string in Vector2D
Line: 68
Char: 63
Code: 0
URI: http://localhost/wordpress/wp-content/themes/parallelus-mingle/assets/css/PIE.htc

I actually narrowed it down even further and this line is the one causing the error:

addLoadEvent(loadMap);

Here is the complete code for the addLoadEvent(loadMap):

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
<script  type="text/javascript">
function addLoadEvent(func) { 
var oldonload = window.onload; 
if (typeof window.onload != 'function'){ 
    window.onload = func
} else { 
    window.onload = function() {
        oldonload();
        func();
    }
}
}

var map,
    infowin=new google.maps.InfoWindow({content:'moin'});
function loadMap() 
{
  map = new google.maps.Map(
    document.getElementById('map'),
    {   
      zoom: 12,
      mapTypeId:google.maps.MapTypeId.ROADMAP,
      center:new google.maps.LatLng(<?php echo $_SESSION['pav_event_latitude']; ?>, 
                                    <?php echo $_SESSION['pav_event_longitude']; ?>)
    });

  addPoints(myStores);
}

function addPoints( points )
{  
  var bounds=new google.maps.LatLngBounds();
  for ( var p = 0; p < points.length; ++p )
  {
    var pointData = points[p];
    if ( pointData == null ) {map.fitBounds(bounds);return; }
    var point = new google.maps.LatLng( pointData.latitude, pointData.longitude );
    bounds.union(new google.maps.LatLngBounds(point));
    createMarker( point,  pointData.html );
  }
  map.fitBounds(bounds);

}

var number = 2; // or whatever you want to do here
function createMarker(point,  popuphtml) 
{
  var popuphtml = "<div id=\"popup\">" + popuphtml + "<\/div>";
  var marker = new google.maps.Marker(
    {
      position:point,
      map:map,
      icon:'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld='+number+'|FF776B|000000',
      shadow:'https://chart.googleapis.com/chart?chst=d_map_pin_shadow'
    }
  );
  google.maps.event.addListener(marker, 'click', function() {
      infowin.setContent(popuphtml)
      infowin.open(map,marker);
    });

}
</script>

Any ideas why that would cause an error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:05:58+00:00Added an answer on May 30, 2026 at 10:05 pm

    It appears that your addLoadEvent() isn’t working as it should, and is sending your empty argument list for loadMap() to the PIE.htc onload event method. Also, I believe the typeof of a function will actually return object not function. Either way, try dropping this in place of your function:

    function addLoadEvent(func) { 
        if (window.addEventListener) {
            window.addEventListener('load', func, false);
        } else if(window.attachEvent) {
            window.attachEvent('onload', func);
        }
    }
    

    Another option, which would ensure that it works in all browsers, would be to use jQuery’s $(document).ready(), domReady, or some other equivalent.

    Edit:
    Also, this line:

    var myStores = [<?php echo $jsData;?>, null];
    

    will end up with two commas before the null, unless you left out some PHP code in your original question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, See the code below: function menu() { this.menuitem=[]; this.submenu=[]; this.menuitem[0] = $('div#sivname1'); this.menuitem[1]
All, Say I have the following bit of code: select: function(start, end, allDay) {
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
All I want is to update an ListViewItem's text whithout seeing any flickering. This
All, I have the following code: $fetch = mysql_query(SELECT * FROM calendar_events where event_status='booked'
All the code/commands below are part of a PHP script that processes images from
All, Say I have the following divs: <div id=rotate_container> <div class=reviews id=item1>This is item
all! What is wrong with this code? I cannot understand what I am doing
All, I have some script tags that are not working in Wordpress. If I
All, I am trying to create a table to receive user inputs (UGC). This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.