- iPhone topik
- Samsung Galaxy S24 Ultra - ha működik, ne változtass!
- Mobil flották
- Xiaomi 17 Ultra - jó az optikája
- Itt a Galaxy S26 széria: az Ultra fejlődött, a másik kettő alig
- Samsung Galaxy A54 - türelemjáték
- Vivo X300 Pro – messzebbre lát, mint ameddig bírja
- Európába tart a Xiaomi Watch 5, eSIM-es verzió is jöhet
- Kezünkben a OnePlus 15 és az Oppo Find X9-ek
- Apple iPhone 17 Pro Max – fennsík
-
Mobilarena
JavaScript != Java (A JavaScript nem összekeverendő a Javával, két különböző programozási nyelvről van szó!)
Új hozzászólás Aktív témák
-
tildy
nagyúr
Sziasztok!
PHPban van foreach , az érdekelne, van-e erre valami megoldás javascriptben is.
PHP a kód nagy része, van benne egy tömb is ,a mit szeretnék használni :
vlahogy igy :
foreach ($matches[0] as $key=>$value)
{
$coordinata =preg_split(''/ \|\ /'',$matches[0][$key]);
//és ide lenne a javascript kód
$.html= <<<EOH
<script type=''text/javascript''>
var point = new GLatLng($coordinata[1], $coordinata[0]);
var marker = createMarker(point,'<div style=''width:240px''>Eov koordináták : <br/> x: $coordinata[1]<br/> y: $coordinata[0]</a> </div>')
map.addOverlay(marker);
</script>
EOH;
}
Na de nem tudom, hogy kéne ehhez átírnom ezt:
$html = <<< EOH
<div id=''map'' style=''width: 550px; height: 450px''></div>
<noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b>
However, it seems JavaScript is either disabled or not supported by your browser.
To view Google Maps, enable JavaScript by changing your browser options, and then
try again.
</noscript>
<script type=''text/javascript''>
//<![CDATA[
if (GBrowserIsCompatible()) {
// A function to create the marker and set up the event window
// Dont try to unroll this function. It has to be here for the function closure
// Each instance of the function preserves the contends of a different instance
// of the ''marker'' and ''html'' variables which will be needed later when the event triggers.
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, ''click'', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
// Display the map, with some controls and set the initial location
var map = new GMap2(document.getElementById(''map''));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng($eovwgs[1], $eovwgs[0]),8);
// Set up three markers with info windows
var point = new GLatLng($eovwgs[1], $eovwgs[0]);
var marker = createMarker(point,'<div style=''width:240px''>Eov koordináták : <br/> x: $eov_x <br/> y: $eov_y </a> </div>')
map.addOverlay(marker);
}
// display a warning if the browser was not compatible
else {
alert(''Sorry, the Google Maps API is not compatible with this browser'');
}
//]]>
</script>
EOH;
Új hozzászólás Aktív témák
- DELL Precision 7550 ntel Core I7-10750H, 64 GB, 1TB SSD MAGYAR VILÁGITÓS BILL
- Lenovo Thinkpad T14 GEN5 Ultra7 165U, 1 tb, 32gb ram, MAGYAR VILÁGÍTÓ BILLENTYŰZET GARIS
- Új MSI 15 Katana FHD IPS 144Hz i7-13620H 10mag 16GB DDR5 1TB SSD Nvidia RTX 4060 8GB Win11 Garancia
- Eladó garanciális Synology DS223j NAS
- Dell Precision 5530 15,6" UHD touch, i7 8850H, 16GB RAM, 4GB VGA, 512GB SSD, jó akku, számla, gar
- Katonai Rugged laptopok Panasonic Toughbook és Getac S410 6-11.gen gar.
- 195 - Lenovo Legion Pro 5 (16IAX10) - Intel Core U7 255HX, RTX 5070 (ELKELT)
- Bomba ár! Lenovo IdeaPad 3: i3-10GEN I 8GB I 256SSD I 14" FHD I Cam I W11 I Garancia!
- Készpénzes / Utalásos Videokártya és Hardver felvásárlás! Személyesen vagy Postával!
- AKCIÓ! Dell XPS 13 9305 13 FHD üzleti notebook -i5 1135G7 8GB DDR4 512GB SSD Intel IRIS XE W11
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

