Javascript error when calling a function in initialize()
I have a page for carpools. I made some changes to the function that calls initialize and now getting errors. Here is the page:
http://开发者_如何学JAVAwww.comehike.com/hikes/hike_carpool.php?hike_id=180
What is the correct way to have the second argument when I call the initialize function? I think some JavaScript errors are coming from there.
You're not using your quotes right:
onload="initialize( 180 , "Hike_Carpool" ); placeHikeStartMarker( 180 ); placeCarpoolPassengersMarkers( 180 ); placeCarpoolDriversMarkers( 180 );"
Should be:
onload="initialize( 180 , 'Hike_Carpool' ); placeHikeStartMarker( 180 ); placeCarpoolPassengersMarkers( 180 ); placeCarpoolDriversMarkers( 180 );"
Notice the single-quotes on the Hike_Carpool parameter.
This is because of the double-quoted onload element attribute. The double-quotes on the initialize function cannot be parsed correctly, creating a syntax error.
精彩评论