Script Categories













Messages >>> Phone Lookup.

Allows the user to enter their area code and phone number and have the modem dialup phone number for their area displayed. If their area code matches an area code as defined in the script, the appropriate dialup number is displayed. For all other area codes, an error message is displayed. Only supports one dialup number per area code, though.

[ We set up our example for phone numbers in the 972 or 214 area codes. ]
Phone #:() -
Dialup #:

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function showNumber(areacode) {
var num = "no # avail.";
var numArray = new Array();
numArray[0] = "972-865-0073";  // add more entries here
numArray[1] = "214-469-4010";
for (var i = 0; i < numArray.length; i++) {
var acode = numArray[i].substring(0, 3);
if (acode == areacode)
var num = "" + numArray[i].substring(0, 18);
}
return num;
}
//  End -->
</script>
<font face="arial, helvetica" size="-1">[ We set up our example for phone numbers in the 972 or 214 area codes.  ]
<form>
<table border=1>
<tr><td>
Phone #:</td><td align=center>(<input type=text name=areacode size=3 maxlength=3 value="972">) <input type=text name=block size=3 maxlength=3>-<input type=text name=extension size=4 maxlength=4></td></tr>
<tr><td
colspan=2 align=center><input type=button value="Show Dialup Number" onClick="this.form.number.value = showNumber(this.form.areacode.value)"></td></tr>
<tr><td>
Dialup #:</td><td align=center><input type=text name=number size=12 maxlength=12></td></tr>
</table>
</form>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©