# Div Overlay - getting translucent background, how do i make opaque?



## StevieJdelsim (Mar 11, 2010)

I am using some example code to provide a "livesearch" for my website.. i have been tinkering with a widely quoted example from W3Schools website which consists of HTML, Javascript and PHP (listed below). What i get is the search results (suggestions) displayed in the overlay (great), but the overlay is translucent and i need it to be opaque due to strong colours making results unreadable.. any help gratefully received...

#############HTML###############

















##############JAVASCRIPT##############

var xmlhttp;

function showResult(str)
{
if (str.length==0)
{
document.getElementById("livesearch").innerHTML="";
document.getElementById("livesearch").style.border="0px";
return;
}
xmlhttp=GetXmlHttpObject()
if (xmlhttp==null)
{
alert ("Your browser does not support XML HTTP Request");
return;
}
var url="livesearch.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged ;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("livesearch").innerHTML=xmlhttp.responseText;
document.getElementById("livesearch").style.border="1px solid #A5ACB2";
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}

######################################PHP################

<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load("links.xml");

$x=$xmlDoc->getElementsByTagName('link');

//get the q parameter from URL
$q=$_GET["q"];

//lookup all links from the xml file if length of q>0
if (strlen($q) > 0)
{
$hint="";
for($i=0; $i<($x->length); $i++)
{
$y=$x->item($i)->getElementsByTagName('title');
$z=$x->item($i)->getElementsByTagName('url');
if ($y->item(0)->nodeType==1)
{
//find a link matching the search text
if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q))
{
if ($hint=="")
{
$hint="" [/COLOR][/SIZE][/COLOR][/SIZE][SIZ...SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000] [/COLOR][/SIZE][/COLOR][/SIZE][SIZ...SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000] [/COLOR][/SIZE][/COLOR][/SIZE][SIZ...SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000] . 
$y->item(0)->childNodes->item(0)->nodeValue . "";
}
else
{
$hint=$hint . "
" [/COLOR][/SIZE][/COLOR][/SIZE][SIZ...SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000] [/COLOR][/SIZE][/COLOR][/SIZE][SIZ...SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000] [/COLOR][/SIZE][/COLOR][/SIZE][SIZ...SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000] . 
$y->item(0)->childNodes->item(0)->nodeValue . "";
}
}
}
}
}

// Set output to "no suggestion" if no hint were found
// or to the correct values
if ($hint == "")
{
$response="no suggestion";
}
else
{
$response=$hint;
}

//output the response
echo$response;
?>


----------



## Eriksrocks (Aug 7, 2005)

Do you have a link to the site? There is no reference to transparency in the code you posted.


----------

