sepoto Posted February 17, 2012 Share Posted February 17, 2012 I am trying to check for null but the code here is not achieving that result yet. I have tried a few variations of the below code but I have not really cracked it yet. Does anyone have suggestions? I just want to check for null as below: <?php header('Content-type: text/javascript'); ?>(function() {//function//window.onload//window.onloadwindow.onload = function() {// Creating a reference to the mapDivvar mapDiv = document.getElementById('map');// Creating a latLng for the center of the mapvar latlng = new google.maps.LatLng(37.09, -95.71);// Creating an object literal containing the properties// we want to pass to the mapvar options = {center: latlng,zoom: 4,mapTypeId: google.maps.MapTypeId.ROADMAP};//window.onload// Creating the mapvar map = new google.maps.Map(mapDiv, options);////////////////////////////////////////////////////////////////////google.maps.event.addListener(map, 'bounds_changed', function() {window.bounds = map.getBounds();if("<?php echo $physical_address; ?>" == null) alert("Alert Sepy.");});////////////////////////////////////////////////////////////////////}//window.onload})();//function Link to comment Share on other sites More sharing options...
sepoto Posted February 17, 2012 Author Share Posted February 17, 2012 In this case the $physical_address came from an html form text field initialized to value="". So the correct code turns out to be if("<?php echo $physical_address; ?>" == "") alert("Alert Sepy."); as opposed to what I have in my original posting. It works very well this way. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.