Link - in neuem Fenster öffnen - funktioniert nicht im IE
gerch2003
- php
Hi Leute, folgendes Problemchen was ich da hab.
Habe einen Php-Code welcher mir bild und Text in einem Kasten ausgibt.
Diesen kasten habe ich verlinkt, so dass er in einem neuen Fenster öffnet.
Leider funktioniert das mit dem IE nicht.
Hier mal der Code:
<?php
// Datenbankverbindung - Beenden
mysql_close();
// Datenbankverbindung - herstellen
mysql_connect($SQL_Server_2, $SQL_User_2, $SQL_Pword_2);
mysql_select_db($SQL_DB_2);
//---------- Nach Immobilie der Woche suchen ----------
$mysql_select = "SELECT uebler_top_offer.object_nr,short,headline,uebler_objects.price AS objects_price,uebler_top_offer.price AS offer_price,basis,pic_1,thumb FROM uebler_top_offer,uebler_objects WHERE uebler_top_offer.object_nr=uebler_objects.object_nr;";
$mysql_result = mysql_query( $mysql_select );
if ($mysql_result && mysql_num_rows($mysql_result) > 0) {
$output = mysql_fetch_array($mysql_result);
echo("<a href=\"http://www.maklerbuero-uebler.de\" target=\"_blank\">
<table width=\"150\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:solid 2px #008231;margin-top:15px;\">
<tr>
<td align=\"center\" style=\"background: url(http://www.maklerbuero-uebler.de/images/advertise/immo_back.gif);\">
<a href=\"http://www.maklerbuero-uebler.de\" target=\"_blank\">
<table cellpadding=\"0\" cellspacing=\"0\" class=\"navig\" style=\"cursor:pointer;\">
<tr>
<td align=\"center\"><img src=\"http://www.maklerbuero-uebler.de/images/advertise/immo_head_2.gif\" width=\"143\" height=\"67\" style=\"border:0px;\"></td>
</tr>");
//---------- Auf Vorschau-Bild prüfen ----------
// if (strlen($output['pic_1']) > 1) {
// if (file_exists("http://www.maklerbuero-uebler.de/pictures/".substr($output['pic_1'], 1)))
$picture = "http://www.maklerbuero-uebler.de/pictures/".substr($output['pic_1'], 1);
// }
// elseif (strlen($output['thumb']) > 1) {
// if (file_exists("http://www.maklerbuero-uebler.de/pictures/".substr($output['thumb'], 1)))
// $picture = "http://www.maklerbuero-uebler.de/pictures/".substr($output['thumb'], 1);
// } // Auf Vorschau-Bild prüfen
//----------Vorschau-Bild vorhanden ----------
if ($picture) {
echo("<tr>
<td align=\"center\"><img src=\"".$picture."\" width=\"139\" style=\"margin-top:3px;border: solid 2px #008828;\"></td>
</tr>");
} // Vorschau-Bild vorhanden
//---------- Info-Text / Preis ----------
if ($output['short'] || $output['headline'] || $output['offer_price'] || $output['objects_price'] || $output['basis']) {
echo("<tr>
<td align=\"center\" style=\"padding:2px;\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tophouse\" style=\"background: url(http://www.maklerbuero-uebler.de/images/advertise/immo_text_m.gif);\">
<tr>
<td>
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tophouse\" style=\"background: url(http://www.maklerbuero-uebler.de/images/advertise/immo_text_t.gif) no-repeat;\">
<tr>
<td>
<table border=\"0\" width=\"143\" cellpadding=\"4\" cellspacing=\"0\" class=\"tophouse\" style=\"background: url(http://www.maklerbuero-uebler.de/images/advertise/immo_text_b.gif) no-repeat bottom;\">
<tr>
<td align=\"center\" style=\"font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;font-size: 11px;\">");
//---------- Info-Text aus Top-Angebot ----------
if ($output['headline']) {
$text = $output['headline'];
include("include/text.php");
$output['headline'] = $text;
echo($output['headline']."<br>");
} // Info-Text aus Top-Angebot
//---------- Info-Text aus Objekt ----------
elseif ($output['short']) {
$text = $output['short'];
include("include/text.php");
$output['short'] = $text;
echo($output['short']."<br>");
} // Info-Text aus Objekt
//---------- Preis aus Top-Angebot ----------
if ($output['offer_price'])
echo("<strong>Schnäppchenpreis:<br>".number_format($output['offer_price'], 0, ",", ".")." €</strong>");
//---------- Preis aus Objekt ----------
elseif ($output['objects_price'])
echo("<strong>Schnäppchenpreis:<br>".number_format($output['objects_price'], 0, ",", ".")." €</strong>");
//---------- Verhandlungsbasis aus Objkekt ----------
elseif($output['basis'])
echo("<strong>Verhandlungsbasis:<br>".number_format($output['basis'], 0, ",", ".")." €</strong>");
echo("</td>
</tr>
</table>
<table border=\"0\" width=\"143\" height=\"11\" cellpadding=\"4\" cellspacing=\"0\" class=\"tophouse\" style=\"background: url(http://www.maklerbuero-uebler.de/images/advertise/immo_foot.gif) no-repeat;\">
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>");
}
echo("</table>
</a>
</td>
</tr>
</table>");
} // Nach Immobilie der Woche suchen
// Datenbankverbindung - Beenden
mysql_close();
// Datenbankverbindung - Wiederherstellen
mysql_connect($SQL_Server, $SQL_User, $SQL_Pword);
mysql_select_db($SQL_DB);
?>
Über den Php-Code brauchen wir nicht reden, ich weis dass der nicht super ist ;-)
Gruß
Seit wann kann man eigentlich keine Tabellen mehr im IE verlinken? oO
Naja gut hab das Problem auf jeden fall gefunden. Man kann im IE keine Tabellen verlinken.
Also:
<a href="1.html" target="_blank">
<table>
<tr>
<td> </td>
</tr>
</table>
</a>
geht NICHT!
Es muss:
<table onClick=\"window.open('1.html')\" style=\"cursor:pointer;\">
<tr>
<td> </td>
</tr>
</table>
heißen. Der Cursor:pointer sollte mit rein, damit der User auch merkt dass es ein Link ist, weil sich eben beim darauf fahren der Mauszeiger in ne Hand ändert.
EDIT: => CLOSE
Gruß
Hallo,
Seit wann kann man eigentlich keine Tabellen mehr im IE verlinken?
ich weiß nicht, warum der IE das mal geduldet hat - aber die Frage ist beim IE auch müßig.
Tatsache ist: Es geht nicht. Es ist ungültiges HTML.
Ein a-Element darf nur inline-Inhalte haben! Als weitere Einschränkung darf a kein weiteres a enthalten.
Naja gut hab das Problem auf jeden fall gefunden. Man kann im IE keine Tabellen verlinken.
Man kann/darf es grundsätzlich nicht. Noch nie.
<table onClick=\"window.open('1.html')\" style=\"cursor:pointer;\">
Wenn du jetzt noch das Attribut korrekt schreibst (nicht onClick, sondern onclick), ist es okay. Dass Besucher ohne Javascript außen vor bleiben, sollte dir klar sein; für die solltest du also eine Alternative bieten (z.B. einen gewöhnlichen Link *innerhalb* der Tabelle oder daneben, darüber, darunter).
Und wenn du das nächste mal wieder ein offensichtlich clientseitiges Phänomen hast, wirf uns bitte nicht seitenweise PHP-Code hin, der nichts damit zu tun hat, sondern gib nur den beim Client ankommenden Code an - ggf. sinnvoll gekürzt.
So long,
Martin