Link to home
Start Free TrialLog in
Avatar of rcleon
rcleonFlag for United States of America

asked on

Open image on a new window

All I'm trying to do is open an image on a new window. Here is my code:

print "\n<tr>";
print "<td rowspan='2'>" . "<a href='#' onclick=\'window.open
('img src=$Row[SP1],directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');return false\' target=\"_blank\">" . "</a></td>";
print "\<\tr>";

I do not get an error but the image dose not show up.

So 2 thing I want my image to show up as a link and went the usser clicks on the link I want the image to show up on a new window.

Thanks

Rafael
Avatar of hernst42
hernst42
Flag of Germany image

Try this code

print "\n<tr>";
print "<td rowspan='2'>" . "<a href='#' onclick=\"window.open('" . $Row['SP1'] ."','NameOfTheWindow', 'width=100,height=200,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');return false\">" . "linkname</a></td>";
print "<tr>";
Avatar of rcleon

ASKER

Thanks,

It is almost there linkname is a small image of SP1 Now the image does not show but the name linkname does and went I click the new window opens with the large picture the small picture is SP1 and the large picture is LP1.


print "\n<tr>";
print "<td rowspan='2'>" . "<a href='#' onclick=\"window.open('" . $Row['LP1'] ."','NameOfTheWindow', 'width=100,height=200,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');return false\">" . "this should be $row['SP1']</a></td>";
print "<tr>";

Or something like that.

Thanks for you quick responce.

Rafael
SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rcleon

ASKER

OK almost

print "<td rowspan='2'>" . "<a href='#' onclick=\"window.open(' ."<img src=\"$Row[LP1]\">" . ','NameOfTheWindow', 'width=100,height=200,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');return false\">" . "<img src=\"$Row[SP1]\" border='0'>" ."</a></td>";

I get an error
Parse error: parse error, unexpected T_STRING in /home/mendoc2/public_html/content/moreinfo.php on line 253

Thanks fir the reference

Rafael
Avatar of Diablo84
Diablo84

You seen to have a little bit of confused coding there, perhaps:

print "<td rowspan='2'><a href='#' onclick=\"window.open('".$Row['LP1']."','NameOfTheWindow', 'width=100,height=200,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');return false\"><img src=\"".$Row['SP1']."\" border='0'></a></td>";
Avatar of rcleon

ASKER

Almost

print "<td rowspan='2'><a href='#' onclick=\"window.open('".<img src=\"$Row['LP1']\">."','NameOfTheWindow', 'width=100,height=200,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');return false\"><img src=\"".$Row['SP1']."\" border='0'></a></td>";


.$Row['LP1'] is an image also LP1 is a large image and SP1 is a small image went I click on sp1 the small image I want LP1 the large image to open on a new window.

Thanks

Rafael
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rcleon

ASKER

Thanks guys I made it work after reading the article on quotes the you guys reference about.

Thanks for all your help
Avatar of rcleon

ASKER

Guys I made it work here is the final code.

print "<td rowspan='2'><a href='#' onclick=\"window.open('".$Row['LP1']."','NameOfTheWindow', 'width=500,height=240,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');return false\"><img src=\"".$Row['SP1']."\" border='0'></a></td>";

Both of the images url are part of the MySQL database a small image apears on the page went you click on the small image a new page is loaded with the large image.

This is just what I wanted.

Once again Thanks you for all your help.

Rafael