I'm a he/him....LOL
Thanks, I'll start looking into what both of you mentioned above.
In the mean time here is the js file I use for my ajax
- Code: Select all
var xmlhttp;
function CreateAjax()
{
try
{
xmlhttp=new XMLHttpRequest();
}
catch(e)
{
try
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e)
{
try
{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e)
{
alert("Unsupported explorer");
return false;
}
}
}
}
function unitconversion_1_Func()
{
var strArray=new Array();
document.getElementById("unitconversion_1_msg").innerHTML=" ";
var unitconversion_1_l1=document.getElementById("unitconversion_1_l1").value;
if((unitconversion_1_l1=="")||isNaN(unitconversion_1_l1))
{
document.getElementById("unitconversion_1_msg").innerHTML=valuemsg;
return;
}
var unitconversion_1_l1_unit=document.getElementById("unitconversion_1_l1_unit").options[document.getElementById("unitconversion_1_l1_unit").selectedIndex].text;
var unitconversion_1_l2_unit=document.getElementById("unitconversion_1_l2_unit").options[document.getElementById("unitconversion_1_l2_unit").selectedIndex].text;
var url="unitconversion_1.asp?l1="+unitconversion_1_l1+"&l1_unit="+unitconversion_1_l1_unit+"&l2_unit="+unitconversion_1_l2_unit
document.getElementById("unitconversion_1_msg").innerHTML=startmsg;
document.getElementById("unitconversion_1_l2").innerHTML=" "
CreateAjax();
xmlhttp.open("GET",url,true);
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
document.getElementById("unitconversion_1_msg").innerHTML=successmsg;
strArray=xmlhttp.responseText.split(",");
document.getElementById("unitconversion_1_l2").innerHTML=strArray[0];
}
else
{ //alert('header returned is ' +xmlhttp.getAllResponseHeaders())
document.getElementById("unitconversion_1_msg").innerHTML=errormsg;
}
}
};
xmlhttp.send(null);
}
Here is the Html for the interface to the js posted above
- Code: Select all
<script type="text/javascript">
var valuemsg=" Invalid input value!";
var startmsg=" Calculating...";
var successmsg=" Success!";
var errormsg=" Failed!";
</script>
<p>Imperial units:</p>
<p>1 inch = 25.4 mm</p>
<p>1 foot = 30.5 cm</p>
<p>1 mil = 0.0254 mm</p>
<p></p>
<p>Metric units</p>
<p>1 m = 100 cm</p>
<p>1 cm = 10 mm</p>
<p>1 mm = 1000 micron</p>
<p></p>
<p>A unit of input, calculation of another:</p>
<script language="javascript" type="text/javascript" src="<?=$enImgUrl?>unitconversion.js"></script>
<table class="ekswaistyle" bgcolor="#ffffce"
cellpadding="5" width="410">
<tbody><tr>
<td width="200">Length 1</td>
<td align="center" width="70"><input size="10"
name="unitconversion_1_l1" id="unitconversion_1_l1" type="text"></td>
<td width="40"><select size="1"
name="unitconversion_1_l1_unit" id="unitconversion_1_l1_unit"><option>m</option><option>cm</option><option
selected="selected">mm</option><option>um</option><option>feet</option><option>inch</option><option>mils</option></select></td>
</tr>
<tr>
<td colspan="3"> <input
value="Calculate" onclick="unitconversion_1_Func()" type="submit"><font
color="#ff0000"><span id="unitconversion_1_msg"> </span></font></td>
</tr>
<tr>
<td width="200">Length 2</td>
<td align="center" width="70"><span id="unitconversion_1_l2"> </span></td>
<td width="40">
<select size="1" name="unitconversion_1_l2_unit" id="unitconversion_1_l2_unit"><option>m</option><option>cm</option><option
selected="selected">mm</option><option>um</option><option>feet</option><option>inch</option><option>mils</option></select></td>
</tr>
</tbody></table>
<br>
</td>
This is only if you interested in this problem too, I'm going to continue to try to figure it out but if someone else wants to jump in then above should be all the code you need
, it's just a simple metric to imperal converter...
Thank you both for all your help and direct thus far, it gives me idea's to look into rather than beating my head agianst the wall....LOL