I was wondering if anyone could show me how to take a string that is entered and then find that string and use it as my unit of measure . I also have to find a number that is part of a string. for example: How many feet in an 24 inches? If you could point me to a good tutorial I have been looking at several today and they have lead here stuck. I just need a push in the right direction. This is a begginer program and so what you see is what you get.
<html>
<head>
<title>Metric Conversion </title>
<script type='text/JavaScript'>
<!--
function convert() {
var input=document.getElementById("input")
if(document.form.textinput.value=='')
{
alert('Please enter a valid unit of measure');
return false;
} else {
if(form=="feet"){
var res=3.2808*document.form.input.value;
var unit=" meters";
}else{
if(form=="inches")
var res=0.3048*document.form.input.value;
var unit=" meters";
}
return false;
}
}
//-->
</script>
</head>
<body>
<form id = "myForm" action = "">
<p>
<h1><span style="padding-left: 500px; text-shadow: 8px 8px 8px #FF0000; font-size: 46px;"> Metric Conversions</span></h1>
</p>
<p><span style="font-size: 14px; color: #F00;">Please enter the unit you would like converted into metrics:</span>
<input name = "input" type = "text" placeholder="How many inches are in 2 meters" size =
"150" />
<input type = "button" value = "Convert"
onclick = "convert()" />
</p>
</form>
<div id=result></div>
</body>
</html>