ReportingAnalyst
MIS
Hi,
Hi,
I have link on which I click and I am able to see all the products for the link. However when I refresh it, I need to click on the link 2 times and it displays and hides the products below the category link. Thereafter when I click on the link once, I get to show and hide the products.
What is it causing the 2 times click when I refresh the page?
My Javascript code is:
Hi,
I have link on which I click and I am able to see all the products for the link. However when I refresh it, I need to click on the link 2 times and it displays and hides the products below the category link. Thereafter when I click on the link once, I get to show and hide the products.
What is it causing the 2 times click when I refresh the page?
My Javascript code is:
Code:
var xmlHttp
function showProducts(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getProducts.asp"
url=url+"?ID="+str
//alert(url);
//url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged1
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged1()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
//objID = 'UI_'+el;
//document.getElementById(objID).innerHTML=xmlHttp.responseText
document.getElementById("content_products").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest) //Safari, Mozilla browers
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject) //IE browsers
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
function s_Hide(el){
//alert("Showing Element: "+el);
objID = 'UI_'+el;
//alert(objID);
obj = document.getElementById(objID).style;
(obj.display == 'none')? obj.display = 'block' : obj.display = 'none';
}