hi, i need to call the java script function from php.here my code $strQuery = "select name from markers LIMIT 0 , 10"; $rsrcResult = mysql_query($strQuery); echo "<select name='logdropdown' >"; while($arrayRow = mysql_fetch_assoc($rsrcResult)) { $type= $arrayRow["name"]; $id= $arrayRow["$id"]; echo "<option value=''>$type<option/>"; } echo "</select>\n\n"; i need to call function searchLocation() and selected option pass as i/p to seachlocation function. my java script code function searchLocations() { var address = document.getElementById('addressInput').value; geocoder.getLatLng(address, function(latlng) { if (!latlng) { alert(address + ' not found'); } else { searchLocationsNear(latlng); } }); } how it is possible.is any one help me do that. thanks
Just stick a call to the functions you want at the end of the page output then as the browser renders the page they will run, or use the onload event.
just call in php: <?php echo '<script> function_name(); </script>'; ?> PHP is serverside and is compiled before any HTML is loaded, therefor you must make php echo this so when the page is loaded in the browser it calls the JS function. - Scripteen.com