MD-4
MD-4

Reputation: 311

Pop-up window when clicking on an image in my HTML page

I know this question has been asked before, but mine is a little different.

I know tthat to do a popup of a thumbnail i have to use Javascript and give te image location. however, what i want to do is this;

<IMG SRC="test.png" ALT="test1" WIDTH=32 HEIGHT=32 onclick="openWin(test.png)"></a> 

where test.PNG is a picture i just queried from the database in SQLPLUS. i do not have a local copy and i do not know the path to id. when i write the javascript function for this, i wrote:

<script language="JavaScript">

function openWin(img) {
    window.open(img);

}
</script>

however, i keep getting a URL\image.png does not exist. How can i get this working? it has to work for an arbitrary number of images, depending on how many actually meet the requirements of the query.

the test.png does not actually exist, i wanted to see becuase it shows as a broken image icon in my table, but when i click on it, it says the URL does not exist.

Upvotes: 1

Views: 14426

Answers (1)

Miss Cat
Miss Cat

Reputation: 21

Screw Javascript. You don't need Javascript for this. Lose the 'onclick' and put 'target="_Blank"' in an 'href' tag around the 'img' tag.

Example:

<a href="YourLink" target="_Blank">
    <img src="test.png" alt="Put something more exciting here." width="32" height="32" />
</a>

All good? By the way, this isn't PHP, my friend. Hehe. Wrong hashtag.

Upvotes: 2

Related Questions