I need some help. When the user enters a number if there is a match I want it to display as a hyperlink to that specific section of an intranet site we have at work. I have quite a lot of data but have only put a few entries on as a example and not sure how to get it to display as a link.
[HTML]<html>
<head>
<TITLE>number Search</TITLE>
<script type="text/javascript">
var numbers = {"^[A-Z]{3}[A-Z0-9]$" : "Google",
"^S[A-Z0-9]{3}$" : "Yahoo",
"^G[A-Z0-9]{3}$" : "Hotmail",
"^U291$" : "Google"};
function getPhoneNumber(theForm)
{
var numberString = theForm.number.value;
var phoneNumField = theForm.phoneNum;
var foundPhoneNum = false;
var currRegExp;
for (var pattern in numbers)
{
currRegExp = new RegExp(pattern, "i");
if (currRegExp.test(numberString))
{
phoneNumField.value = numbers[pattern];
foundPhoneNum = true;
break;
}
}
if (!foundPhoneNum)
alert("no match");
}
</script>
</head>
<body>
<form>
<label for="number">Please Enter Number </label><input type="text" name="number" id="number">
<input type="button" value="Find" onclick="getPhoneNumber(this.form)">
<label for="phoneNum">The webpage is </label><input type="text" name="phoneNum" id="phoneNum">
<input TYPE="reset" NAME="Clear" VALUE="Clear">
</form>
</body>
</html>[/HTML]