/    Sign up×
Community /Pin to ProfileBookmark

Hello All
My friend had given me a script and a .js file for me to use and am unable to get it to work. On [url]http://foxvalleynews.com/6.html[/url], it is to put the – as a ssn would lokk, put in the () and – for phone and – zip can someone please help? I am dumb at this kind of stuff.

dFliter.js is below

var dFilterStep

function dFilterStrip (dFilterTemp, dFilterMask)
{
dFilterMask = replace(dFilterMask,’#’,”);
for (dFilterStep = 0; dFilterStep < dFilterMask.length++; dFilterStep++)
{
dFilterTemp =
replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),”);
}
return dFilterTemp;
}

function dFilterMax (dFilterMask)
{
dFilterTemp = dFilterMask;
for (dFilterStep = 0; dFilterStep < (dFilterMask.length+1);
dFilterStep++)
{
if (dFilterMask.charAt(dFilterStep)!=’#’)
{
dFilterTemp =
replace(dFilterTemp,dFilterMask.charAt(dFilterStep),”);
}
}
return dFilterTemp.length;
}

function dFilter (key, textbox, dFilterMask)
{
dFilterNum = dFilterStrip(textbox.value, dFilterMask+”_”);
if (key>95&&key<106){key -= 48}

if (key==9)
{
return true;
}
else if (key==8&&dFilterNum.length!=0)
{
dFilterNum = dFilterNum.substring(0,dFilterNum.length-1);
}
else if ( ((key>47&&key<58)))
{
dFilterNum=dFilterNum+String.fromCharCode(key);
}

var dFilterFinal=”;

for (dFilterStep = 0; dFilterStep < dFilterMask.length; dFilterStep++)
{
if (dFilterMask.charAt(dFilterStep)==’#’)
{
if (dFilterNum.length!=0)
{
dFilterFinal = dFilterFinal + dFilterNum.charAt(0);
dFilterNum = dFilterNum.substring(1,dFilterNum.length);
}
else
{
dFilterFinal = dFilterFinal + “_”;
}
}
else if (dFilterMask.charAt(dFilterStep)!=’#’)
{
dFilterFinal = dFilterFinal + dFilterMask.charAt(dFilterStep);
}

// dFilterTemp =
replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),”);
}

textbox.value = dFilterFinal;
return false;

}

function replace(fullString,text,by) {
// Replaces text with by in string
var strLength = fullString.length, txtLength = text.length;
if ((strLength == 0) || (txtLength == 0)) return fullString;

var i = fullString.indexOf(text);
if ((!i) && (text != fullString.substring(0,txtLength))) return

fullString;
if (i == -1) return fullString;

var newstr = fullString.substring(0,i) + by;

if (i+txtLength < strLength)
newstr +=

replace(fullString.substring(i+txtLength,strLength),text,by);

return newstr;

}

Thanks for your help in advance

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorApr 08.2003 — Can someone please help me out here? anyone?
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorApr 09.2003 — Hey Dave~

How can I do the zip code for the -? ie. 12345-1234
×

Success!

Help @Tasmanian_Devil spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...