<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
window.alert(xmlhttp.responseText);
}
}
xmlhttp.open("GET","popup.html",true);
xmlhttp.send();
}
</script>
</head>
<body onload="javascript:loadXMLDoc()">
<div id="myDiv"><h2>AJAX image popup</h2></div>
</body>
</html>
Actually i want to use it on a joomla page, but i couldn’t get any extension to do that so i created this script but the popup display html instead of the image in the page code.
I also tried to get the image directly, but its couldn’t display it.
All i want to achieve is for an image to popup when page loads.
Kind regards.
The standard browser “popup” achieved from the JavaScript
alert()function can’t display images. It’s plain text only.One way you could display a “popup” which contains rendered HTML would be to use the jQuery UI Dialog. This essentially creates a modal
divon the page which mimics the functionality of a “popup” within the confines of the DOM. Thatdivcan contain any HTML you want: