简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM