a링크 새창열기
본문
h3클릭시 해당게시물이 새창으로 열리게 하고시싶은데
아래에 그림과같이 _blank를 넣으니
엑박이뜨고 내용자체가 안뜨네요..
<script type="text/javascript">
function mgminfomap(){
var myOptions = {
zoom: 3,
//center: new google.maps.LatLng(27.3114655, 90.94384680000007),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('mgmap'), myOptions);
var locations = [
<? for ($i=0; $i<count($list); $i++) {
$name1=strip_tags($list[$i][subject]);
$lat=($list[$i][wr_3]);
$lng=($list[$i][wr_4]);
$address=strip_tags($list[$i][wr_2]);
$phone=strip_tags($list[$i][wr_content]);
$url=strip_tags($list[$i][wr_link]);
$mapnum=($list[$i][wr_id]);
$mtem="<table><tr><td colspan=2 width=300><a href={$list[$i][href]}><h3>$name1</h3></a></td></tr><tr><td width=70>주소: </td><td width=230>{$address}</td></tr><tr><td width=70>전화번호: </td><td width=230>{$phone}</td></tr></table>";
?>
['<?=$mtem?>', '<?=$lat?>', '<?=$lng?>', '<?=$mapnum?>']
<? if ($i==count($list)-1) continue; ?>
,
<? } ?>
];
var infowindow = new google.maps.InfoWindow();
var marker, i;
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < locations.length; i++) {
var myLatLng = new google.maps.LatLng(locations[i][1], locations[i][2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map
});
bounds.extend(myLatLng);
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
zoomChangeBoundsListener = google.maps.event.addListener(map, "bounds_changed",function(event){
if(this.getZoom() > 20)
this.setZoom(16);
google.maps.event.removeListener(zoomChangeBoundsListener);
});
map.fitBounds(bounds);
}
google.maps.event.addDomListener(window, 'load', mgminfomap);
</script>
<!--지도 끝 -->
답변 5
$mtem = "<table><tr><td colspan='2' width='300px'><a target='_blank' href='".$list[$i]['href']."'><h3>".$name."</h3></a> ";
echo $mtem;
저는 아주잘되는데 이상하네요.
php 랑 html을 같이 사용하시면서 구문오류가 있는것같습니다.
같이 사용하시는것이 어려우시면
따로따로 분리해서 사용하세요.
<table>
<tr>
<td colspan="2" width="300px">
<a target="_blank" href="<?echo $site_url?>">
<h3><?echo $name?></h3>
</a>
</td>
</tr>
</table>
a target = '_blank'
이렇게 해보세요 " 쌍따옴표가 잘못된듯
네 중간에 함수 선언값에 " 쌍따옴표 문제로 보여지네요
syntax error가 안 뜬다면 해당 페이지 주소를 보여 주세요.
a target = '_blank'