Applying background dynamically from ajax [ iframe issue ]
<!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” language=”javascript”>
var http_request = false;
function makeRequest(url,id) {
try {
netscape.security.PrivilegeManager.enablePrivilege(”UniversalBrowserRead”);
} catch (e) {
alert(id);
alert(”Permission UniversalBrowserRead denied.”);
}
http_request = false;
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType(’text/xml’);
}
if (!http_request) {
alert(’Cannot create XMLHTTP instance’);
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open(’GET’, url);
http_request.send(null);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
var string = http_request.responseText;
alert(string);
//if(string.search!==’src’)
//{
change_bgcolor(string);
// }
} else {
alert(’There was a problem with the request.’);
}
}
}
function updateweather() {
makeRequest(’http://media.hotels.com/html.ng/TPID=100002&LOCATION=HOME&PLACEMENT=TOPBAN&AFFILIATE=H-EMEA.DE&SUBLOCATION=OVERVIEW&ADSIZE=468×60′,’test’);
alert(”dfdfd”);
}
function change_bgcolor(string)
{
//document.getElementById(”test”).style.background=’#ff0000′;
document.getElementById(”test”).innerHTML=string;
}*/
</script>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
</head>
<body bgcolor=”#FFFFCC” onload=”updateweather();>
<div id=”test” style=”width:468px; height:60px;top:0px;left:0px;border:none; display:block; background:#FF0000″>
</div>
</body>
</html>
Add comment August 6, 2007


