I am trying to have a picture to load onclick into an alert box but I am getting
"[object HTMLImageElement]"
where the picture should be.
This is what I have:
function joePic(){
var joe_fat = new Image;
joe_fat.src = "pic1.jpg";
alert (joe_fat);
}
<input type="button" value="Click here it find out" name="joePhoto" onclick="joePic()"
height="150" width="150" />
Is this possible?
I am trying to have a picture to load onclick into an alert box but I am getting
"[object HTMLImageElement]"
where the picture should be.
This is what I have:
function joePic(){
var joe_fat = new Image;
joe_fat.src = "pic1.jpg";
alert (joe_fat);
}
<input type="button" value="Click here it find out" name="joePhoto" onclick="joePic()"
height="150" width="150" />
Is this possible?
Share Improve this question edited Nov 9, 2011 at 21:00 pad 41.3k7 gold badges94 silver badges168 bronze badges asked Nov 9, 2011 at 20:44 OvercrankedOvercranked 1753 silver badges14 bronze badges 02 Answers
Reset to default 9No, you can only put plain text (and linebreaks/carriage returns) into an alert box. If you need 'fancy' popups, you'll have to simulate them with a floating overlay on your page.
probably your best bet for this is to use dialog in jquery ui or use one of the separate plugins like colorbox for jquery.
Could also look through here to see if you can find something suitable