how to remove the link from the following javascript?

Posted by murali on Stack Overflow See other posts from Stack Overflow or by murali
Published on 2010-05-19T07:52:16Z Indexed on 2010/05/19 8:00 UTC
Read the original article Hit count: 324

Filed under:
|

hi i am unable to the remove the link from the keywords which are coming from database....

var googleurl="http://www.google.com/#hl=en&source=hp&q=";


function displayResults(keyword, results_array)
{
// start building the HTML table containing the results
var div = "<table>";
// if the searched for keyword is not in the cache then add it to the cache
 try
 {

// if the array of results is empty display a message

if(results_array.length == 0)
{
div += "<tr><td>No results found for <strong>" + keyword +
"</strong></td></tr>";
// set the flag indicating that no results have been found
// and reset the counter for results
hasResults = false;
suggestions = 0;
}
// display the results
else
{
// resets the index of the currently selected suggestion
position = -1;
// resets the flag indicating whether the up or down key has been pressed
isKeyUpDownPressed = false;
/* sets the flag indicating that there are results for the searched for keyword */

hasResults = true;
// loop through all the results and generate the HTML list of results
for (var i=0; i<results_array.length-1; i++)
{
// retrieve the current function
crtFunction = results_array[i];
// set the string link for the for the current function
// to the name of the function
crtFunctionLink = crtFunction;
// replace the _ with - in the string link
while(crtFunctionLink.indexOf("_") !=-1)
crtFunctionLink = crtFunctionLink.replace("_","-");
// start building the HTML row that contains the link to the
//   help page of the current function

div += "<tr id='tr" + i +
"' onclick='location.href=document.getElementById(\"a" + i +
"\").href;' onmouseover='handleOnMouseOver(this);' " +
"onmouseout='handleOnMouseOut(this);'>" +
"<td align='left'><a id='a" + i +
"' href='" + googleurl + crtFunctionLink ;
// check to see if the current function name length exceeds the maximum
// number of characters that can be displayed for a function name
if(crtFunction.length <= suggestionMaxLength)
{
div += "'>" +
crtFunction.substring(0, httpRequestKeyword.length) +
""
div += crtFunction.substring(httpRequestKeyword.length,
crtFunction.length) +
"</a></td></tr>";
}
else
{
// check to see if the length of the current keyword exceeds
// the maximum number of characters that can be displayed
if(httpRequestKeyword.length < suggestionMaxLength)
{ 
div += "'>" +
crtFunction.substring(0, httpRequestKeyword.length) +
""
div += crtFunction.substring(httpRequestKeyword.length,
suggestionMaxLength) +
"</a></td></tr>";
}
else
{
div += "'>" +
crtFunction.substring(0,suggestionMaxLength) +
"</td></tr>"
}
}
}
}
// end building the HTML table
div += "</table>"; 
var oSuggest = document.getElementById("suggest");
var oScroll = document.getElementById("scroll");
// scroll to the top of the list
//oScroll.scrollTop = 1; -- murali commented
// update the suggestions list and make it visible
oSuggest.innerHTML =div;
oScroll.style.visibility = "visible";
// if we had results we apply the type ahead for the current keyword
if(results_array.length > 0)
autocompleteKeyword();
}


catch(e)
{

}
} 

how to remove href tag from the following snippet... when i remove anything the drop down vanishes.... pls help me how to remove the href from the above snippet

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about autocomplete