Hi
I was wondering if someone would help me with this problem as my Javascript skills are very limited.
I am trying to get data to be displayed from a database on a form when a particular cell in a table is clicked.
I was using the following link as my reference guide
The following is the main form.
The Code For the selectwarehouse.js file is as below
I am guessing something in the selectwarehouse.js needs to be changed but I don't know what!
Thanking in advance for any help received
I was wondering if someone would help me with this problem as my Javascript skills are very limited.
I am trying to get data to be displayed from a database on a form when a particular cell in a table is clicked.
I was using the following link as my reference guide
The following is the main form.
Code:
<Html>
<head>
<script src="selectwarehouse.js"></script>
</head>
<body>
<form name="users">
<table>
<tr>
<td>
<table border=2>
<tr bgcolor='#dfdfff'><td><b><center>Warehouse<center></b></td><td><b>Passed</b></td><td><b><center>Failed</center></b></td><td><b><center>Percent</center></b></td></tr>
<tr><td value="DE" onclick="showData(this.value)"><Center>IR</Center></a></Center></td><td><Center>60447</Center></td><td><Center>30470</Center></td><td><Center>66%</Center></td></tr>
</table>
</td>
<td>
<div id="txtHint"><b>Click On Warehouse To See Info Here</b></div>
</td>
</tr>
</table>
</form>
</body>
</html>
The Code For the selectwarehouse.js file is as below
Code:
var xmlHttpfunction showData(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getinfo.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 || xmlHttp.readyState=="complete")
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
}function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
I am guessing something in the selectwarehouse.js needs to be changed but I don't know what!
Thanking in advance for any help received