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.
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.
Share Improve this question edited Apr 1, 2015 at 3:17 Raptor 54.3k47 gold badges248 silver badges399 bronze badges asked Apr 1, 2015 at 2:58 MD-4MD-4 3112 gold badges4 silver badges12 bronze badges 3-
1
Your HTML code is awful. Use lowercase html tags, surround attribute with quotes, separate
onclick
from html tags, surround string values with single quotes, stray</a>
tag found and thelanguage="JavaScript"
has been deprecated for years. Ouch. – Raptor Commented Apr 1, 2015 at 3:03 -
2
So you're trying to load an image that doesn't exist, and you don't like receiving an error that it doesn't exist? That's how it's supposed to work! If you don't want the error, don't attach an
onclick
handler for images which don't exist. – Simon MᶜKenzie Commented Apr 1, 2015 at 3:04 - i understand the image does not exist. what i want to do is have the broken thumbnail icon i get in my table that tells me the image is not there and make it bigger when i click on it. that way, when i have an actual image, it will make it bigger on click – MD-4 Commented Apr 2, 2015 at 0:15
1 Answer
Reset to default 2Screw 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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744844675a4596761.html
评论列表(0条)