admin管理员组文章数量:1327938
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
本文标签: javascriptis it possible to load a picture in an alert boxStack Overflow
版权声明:本文标题:javascript - is it possible to load a picture in an alert box? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742248486a2440302.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论