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. ]
Add the below code to the <body> section of your page:
<scriptlanguage="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 =newArray(); 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> <fontface="arial,
helvetica"size="-1">[
We set up our example for phone numbers in the 972 or 214 area codes. ] <form> <tableborder=1>
<tr><td>Phone #:</td><tdalign=center>(<inputtype=textname=areacodesize=3maxlength=3value="972">)
<inputtype=textname=blocksize=3maxlength=3>-<inputtype=textname=extensionsize=4maxlength=4></td></tr>
<tr><tdcolspan=2align=center><inputtype=buttonvalue="Show
Dialup Number"onClick="this.form.number.value
= showNumber(this.form.areacode.value)"></td></tr>
<tr><td>Dialup #:</td><tdalign=center><inputtype=textname=numbersize=12maxlength=12></td></tr>
</table> </form>